This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renames everything Allora, and cleans up errors. --------- Signed-off-by: Derek Anderson <[email protected]>
- Loading branch information
Showing
13 changed files
with
70 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Allora Network Offchain CGI Extensions Function Example | ||
|
||
This function interacts with the Upshot CGI Extension. |
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
upshot-function-example/bls.toml → allora-inference-function/bls.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
name = "upshot-function-example" | ||
name = "allora-inference-function" | ||
version = "1.0.0" | ||
|
||
[deployment] | ||
nodes = 1 | ||
|
||
[build] | ||
dir = "build" | ||
entry = "upshot-function-example_debug.wasm" | ||
entry = "allora-inference-function_debug.wasm" | ||
command = "npm run build:debug" | ||
|
||
[build_release] | ||
dir = "build" | ||
entry = "upshot-function-example.wasm" | ||
entry = "allora-inference-function.wasm" | ||
command = "npm run build:release" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[2024-01-12T04:42:36Z ERROR bls_runtime] panicked at 'called `Result::unwrap()` on an `Err` value: failed to read input file | ||
|
||
Caused by: | ||
No such file or directory (os error 2)', /Users/runner/work/bls-runtime/bls-runtime/blockless/src/lib.rs:167:68 | ||
[2024-01-12T04:43:09Z ERROR bls_runtime] panicked at 'called `Result::unwrap()` on an `Err` value: failed to read input file | ||
|
||
Caused by: | ||
No such file or directory (os error 2)', /Users/runner/work/bls-runtime/bls-runtime/blockless/src/lib.rs:167:68 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Console } from "as-wasi/assembly"; | ||
import { CgiCommand, cgiExtendsList } from "@blockless/sdk/assembly/cgi"; | ||
import { memory } from "@blockless/sdk/assembly"; | ||
import { buffer2string } from "@blockless/sdk/assembly/strings"; | ||
// env UPSHOT_ARG_PARAMS=FOO BLS_LIST_VARS=UPSHOT_ARG_PARAMS | ||
let envVars = new memory.EnvVars().read().toJSON(); | ||
if (envVars) { | ||
let environmentValue = envVars.get("ALLORA_ARG_PARAMS"); | ||
if (environmentValue) { | ||
// get as list of the extensions available | ||
let l = cgiExtendsList(); | ||
|
||
if (l != null) { | ||
let command = new CgiCommand("cgi-allora-infer", null, null); | ||
let rs = command.exec(); | ||
if (rs == true) { | ||
const SEP = "\r\n"; | ||
let buf = new Array<u8>(1024); | ||
let req = `{"arguments":["${environmentValue.toString()}"]}`; | ||
let req_len = req.length; | ||
let head = `${req_len}${SEP}`; | ||
command.stdinWriteString(head); | ||
command.stdinWriteString(`${req}${SEP}`); | ||
buf = new Array<u8>(65535); | ||
let all_buff: u8[] = new Array(0); | ||
let l = command.stdoutRead(buf); | ||
all_buff = all_buff.concat(buf.slice(0, l)); | ||
let read_string = buffer2string(all_buff, all_buff.length); | ||
Console.log(read_string); | ||
} else { | ||
Console.log( | ||
"error: no response from the inference extension, source: cgi-allora-infer", | ||
); | ||
} | ||
command.close(); | ||
} else { | ||
Console.log( | ||
"error: inference extension not available, source: cgi-allora-infer", | ||
); | ||
} | ||
} else { | ||
Console.log( | ||
"error: inference param not available: ALLORA_ARG_PARAMS, source: cgi-allora-infer", | ||
); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.