mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-23 08:32:23 +03:00
Merge pull request #449 from kinode-dao/release-candidate
Release candidate
This commit is contained in:
commit
4123bd184c
43
Cargo.lock
generated
43
Cargo.lock
generated
@ -3212,7 +3212,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kinode"
|
name = "kinode"
|
||||||
version = "0.8.3"
|
version = "0.8.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm",
|
"aes-gcm",
|
||||||
"alloy",
|
"alloy",
|
||||||
@ -3233,14 +3233,13 @@ dependencies = [
|
|||||||
"hmac",
|
"hmac",
|
||||||
"http 1.1.0",
|
"http 1.1.0",
|
||||||
"jwt",
|
"jwt",
|
||||||
"kit",
|
"kit 0.6.7",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lib",
|
"lib",
|
||||||
"nohash-hasher",
|
"nohash-hasher",
|
||||||
"open",
|
"open",
|
||||||
"public-ip",
|
"public-ip",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"rayon",
|
|
||||||
"reqwest 0.12.5",
|
"reqwest 0.12.5",
|
||||||
"ring",
|
"ring",
|
||||||
"rmp-serde",
|
"rmp-serde",
|
||||||
@ -3269,7 +3268,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kinode_lib"
|
name = "kinode_lib"
|
||||||
version = "0.8.3"
|
version = "0.8.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lib",
|
"lib",
|
||||||
]
|
]
|
||||||
@ -3355,6 +3354,38 @@ dependencies = [
|
|||||||
"zip 0.6.6",
|
"zip 0.6.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kit"
|
||||||
|
version = "0.6.7"
|
||||||
|
source = "git+https://github.com/kinode-dao/kit?rev=4a8999f#4a8999f90b69381e94d11fb5aa1b62215a9db95b"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"base64 0.21.7",
|
||||||
|
"clap",
|
||||||
|
"color-eyre",
|
||||||
|
"dirs 5.0.1",
|
||||||
|
"fs-err",
|
||||||
|
"git2",
|
||||||
|
"hex",
|
||||||
|
"kinode_process_lib 0.8.0 (git+https://github.com/kinode-dao/process_lib.git?rev=7eb3a04)",
|
||||||
|
"nix",
|
||||||
|
"regex",
|
||||||
|
"reqwest 0.11.27",
|
||||||
|
"semver 1.0.23",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"sha2",
|
||||||
|
"tokio",
|
||||||
|
"toml",
|
||||||
|
"tracing",
|
||||||
|
"tracing-appender",
|
||||||
|
"tracing-error",
|
||||||
|
"tracing-subscriber",
|
||||||
|
"walkdir",
|
||||||
|
"wit-bindgen",
|
||||||
|
"zip 0.6.6",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kns_indexer"
|
name = "kns_indexer"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@ -3391,10 +3422,10 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lib"
|
name = "lib"
|
||||||
version = "0.8.3"
|
version = "0.8.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloy",
|
"alloy",
|
||||||
"kit",
|
"kit 0.6.2",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"ring",
|
"ring",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kinode_lib"
|
name = "kinode_lib"
|
||||||
authors = ["KinodeDAO"]
|
authors = ["KinodeDAO"]
|
||||||
version = "0.8.3"
|
version = "0.8.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "A general-purpose sovereign cloud computing platform"
|
description = "A general-purpose sovereign cloud computing platform"
|
||||||
homepage = "https://kinode.org"
|
homepage = "https://kinode.org"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kinode"
|
name = "kinode"
|
||||||
authors = ["KinodeDAO"]
|
authors = ["KinodeDAO"]
|
||||||
version = "0.8.3"
|
version = "0.8.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "A general-purpose sovereign cloud computing platform"
|
description = "A general-purpose sovereign cloud computing platform"
|
||||||
homepage = "https://kinode.org"
|
homepage = "https://kinode.org"
|
||||||
@ -14,8 +14,7 @@ path = "src/main.rs"
|
|||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
anyhow = "1.0.71"
|
anyhow = "1.0.71"
|
||||||
kit = { git = "https://github.com/kinode-dao/kit", tag = "v0.6.2" }
|
kit = { git = "https://github.com/kinode-dao/kit", rev = "4a8999f" }
|
||||||
rayon = "1.8.1"
|
|
||||||
tokio = "1.28"
|
tokio = "1.28"
|
||||||
walkdir = "2.4"
|
walkdir = "2.4"
|
||||||
zip = "0.6"
|
zip = "0.6"
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
fs::{self, File},
|
fs::{self, File},
|
||||||
@ -16,37 +15,30 @@ fn get_features() -> String {
|
|||||||
.to_lowercase()
|
.to_lowercase()
|
||||||
.replace("_", "-");
|
.replace("_", "-");
|
||||||
features.push_str(&feature);
|
features.push_str(&feature);
|
||||||
//println!("cargo:rustc-cfg=feature=\"{}\"", feature);
|
|
||||||
//println!("- {}", feature);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
features
|
features
|
||||||
}
|
}
|
||||||
|
|
||||||
fn output_reruns(dir: &Path, rerun_files: &HashSet<String>) {
|
fn output_reruns(dir: &Path, rerun_files: &HashSet<String>) {
|
||||||
if rerun_files.contains(dir.to_str().unwrap()) {
|
// Check files individually
|
||||||
// Output for all files in the directory if the directory itself is specified in rerun_files
|
if let Ok(entries) = fs::read_dir(dir) {
|
||||||
if let Ok(entries) = fs::read_dir(dir) {
|
for entry in entries.filter_map(|e| e.ok()) {
|
||||||
for entry in entries.filter_map(|e| e.ok()) {
|
let path = entry.path();
|
||||||
let path = entry.path();
|
if let Some(filename) = path.file_name().and_then(|n| n.to_str()) {
|
||||||
println!("cargo:rerun-if-changed={}", path.display());
|
// Check if the current file is in our list of interesting files
|
||||||
}
|
if filename == "ui" {
|
||||||
}
|
continue;
|
||||||
} else {
|
|
||||||
// Check files individually
|
|
||||||
if let Ok(entries) = fs::read_dir(dir) {
|
|
||||||
for entry in entries.filter_map(|e| e.ok()) {
|
|
||||||
let path = entry.path();
|
|
||||||
if path.is_dir() {
|
|
||||||
// If the entry is a directory, recursively walk it
|
|
||||||
output_reruns(&path, rerun_files);
|
|
||||||
} else if let Some(filename) = path.file_name().and_then(|n| n.to_str()) {
|
|
||||||
// Check if the current file is in our list of interesting files
|
|
||||||
if rerun_files.contains(filename) {
|
|
||||||
// If so, print a `cargo:rerun-if-changed=PATH` line for it
|
|
||||||
println!("cargo:rerun-if-changed={}", path.display());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if rerun_files.contains(filename) {
|
||||||
|
// If so, print a `cargo:rerun-if-changed=PATH` line for it
|
||||||
|
println!("cargo::rerun-if-changed={}", path.display());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if path.is_dir() {
|
||||||
|
// If the entry is a directory not in rerun_files, recursively walk it
|
||||||
|
output_reruns(&path, rerun_files);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,13 +51,23 @@ fn build_and_zip_package(
|
|||||||
) -> anyhow::Result<(String, String, Vec<u8>)> {
|
) -> anyhow::Result<(String, String, Vec<u8>)> {
|
||||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||||
rt.block_on(async {
|
rt.block_on(async {
|
||||||
kit::build::execute(&entry_path, true, false, true, features, None, None, true)
|
kit::build::execute(
|
||||||
.await
|
&entry_path,
|
||||||
.map_err(|e| anyhow::anyhow!("{:?}", e))?;
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
features,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.map_err(|e| anyhow::anyhow!("{:?}", e))?;
|
||||||
|
|
||||||
let mut writer = Cursor::new(Vec::new());
|
let mut writer = Cursor::new(Vec::new());
|
||||||
let options = FileOptions::default()
|
let options = FileOptions::default()
|
||||||
.compression_method(zip::CompressionMethod::Stored)
|
.compression_method(zip::CompressionMethod::Deflated)
|
||||||
.unix_permissions(0o755);
|
.unix_permissions(0o755);
|
||||||
{
|
{
|
||||||
let mut zip = zip::ZipWriter::new(&mut writer);
|
let mut zip = zip::ZipWriter::new(&mut writer);
|
||||||
@ -111,14 +113,14 @@ fn main() -> anyhow::Result<()> {
|
|||||||
let rerun_files: HashSet<String> = HashSet::from([
|
let rerun_files: HashSet<String> = HashSet::from([
|
||||||
"Cargo.lock".to_string(),
|
"Cargo.lock".to_string(),
|
||||||
"Cargo.toml".to_string(),
|
"Cargo.toml".to_string(),
|
||||||
"src/".to_string(),
|
"src".to_string(),
|
||||||
]);
|
]);
|
||||||
output_reruns(&parent_dir, &rerun_files);
|
output_reruns(&parent_dir, &rerun_files);
|
||||||
|
|
||||||
let features = get_features();
|
let features = get_features();
|
||||||
|
|
||||||
let results: Vec<anyhow::Result<(String, String, Vec<u8>)>> = entries
|
let results: Vec<anyhow::Result<(String, String, Vec<u8>)>> = entries
|
||||||
.par_iter()
|
.iter()
|
||||||
.filter_map(|entry_path| {
|
.filter_map(|entry_path| {
|
||||||
let parent_pkg_path = entry_path.join("pkg");
|
let parent_pkg_path = entry_path.join("pkg");
|
||||||
if !parent_pkg_path.exists() {
|
if !parent_pkg_path.exists() {
|
||||||
@ -160,7 +162,11 @@ fn main() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeln!(bootstrapped_processes, "];")?;
|
writeln!(bootstrapped_processes, "];")?;
|
||||||
let bootstrapped_processes_path = pwd.join("src/bootstrapped_processes.rs");
|
let target_dir = pwd.join("../target");
|
||||||
|
if !target_dir.exists() {
|
||||||
|
fs::create_dir_all(&target_dir)?;
|
||||||
|
}
|
||||||
|
let bootstrapped_processes_path = target_dir.join("bootstrapped_processes.rs");
|
||||||
fs::write(&bootstrapped_processes_path, bootstrapped_processes)?;
|
fs::write(&bootstrapped_processes_path, bootstrapped_processes)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -76,7 +76,6 @@ pub fn fetch_state(our: Address, provider: eth::Provider) -> State {
|
|||||||
pub fn app_store_filter(state: &State) -> eth::Filter {
|
pub fn app_store_filter(state: &State) -> eth::Filter {
|
||||||
eth::Filter::new()
|
eth::Filter::new()
|
||||||
.address(eth::Address::from_str(&state.contract_address).unwrap())
|
.address(eth::Address::from_str(&state.contract_address).unwrap())
|
||||||
.from_block(state.last_saved_block)
|
|
||||||
.events(EVENTS)
|
.events(EVENTS)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +83,10 @@ pub fn app_store_filter(state: &State) -> eth::Filter {
|
|||||||
pub fn fetch_and_subscribe_logs(state: &mut State) {
|
pub fn fetch_and_subscribe_logs(state: &mut State) {
|
||||||
let filter = app_store_filter(state);
|
let filter = app_store_filter(state);
|
||||||
// get past logs, subscribe to new ones.
|
// get past logs, subscribe to new ones.
|
||||||
for log in fetch_logs(&state.provider, &filter) {
|
for log in fetch_logs(
|
||||||
|
&state.provider,
|
||||||
|
&filter.clone().from_block(state.last_saved_block),
|
||||||
|
) {
|
||||||
if let Err(e) = state.ingest_contract_event(log, false) {
|
if let Err(e) = state.ingest_contract_event(log, false) {
|
||||||
println!("error ingesting log: {e:?}");
|
println!("error ingesting log: {e:?}");
|
||||||
};
|
};
|
||||||
|
@ -6,8 +6,8 @@ wit_bindgen::generate!({
|
|||||||
world: "process-v0",
|
world: "process-v0",
|
||||||
});
|
});
|
||||||
|
|
||||||
/// 20 minutes
|
/// 2 hours
|
||||||
const REFRESH_INTERVAL: u64 = 20 * 60 * 1000;
|
const REFRESH_INTERVAL: u64 = 120 * 60 * 1000;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct KinodeBlogPost {
|
struct KinodeBlogPost {
|
||||||
|
@ -59,9 +59,9 @@ sol! {
|
|||||||
event RoutingUpdate(bytes32 indexed node, bytes32[] routers);
|
event RoutingUpdate(bytes32 indexed node, bytes32[] routers);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn subscribe_to_logs(eth_provider: ð::Provider, from_block: u64, filter: eth::Filter) {
|
fn subscribe_to_logs(eth_provider: ð::Provider, filter: eth::Filter) {
|
||||||
loop {
|
loop {
|
||||||
match eth_provider.subscribe(1, filter.clone().from_block(from_block)) {
|
match eth_provider.subscribe(1, filter.clone()) {
|
||||||
Ok(()) => break,
|
Ok(()) => break,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
println!("failed to subscribe to chain! trying again in 5s...");
|
println!("failed to subscribe to chain! trying again in 5s...");
|
||||||
@ -126,7 +126,6 @@ fn init(our: Address) {
|
|||||||
fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
||||||
let filter = eth::Filter::new()
|
let filter = eth::Filter::new()
|
||||||
.address(state.contract_address.parse::<eth::Address>().unwrap())
|
.address(state.contract_address.parse::<eth::Address>().unwrap())
|
||||||
.from_block(state.block - 1)
|
|
||||||
.to_block(eth::BlockNumberOrTag::Latest)
|
.to_block(eth::BlockNumberOrTag::Latest)
|
||||||
.events(vec![
|
.events(vec![
|
||||||
"NodeRegistered(bytes32,bytes)",
|
"NodeRegistered(bytes32,bytes)",
|
||||||
@ -147,11 +146,11 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
|||||||
state.chain_id
|
state.chain_id
|
||||||
);
|
);
|
||||||
|
|
||||||
subscribe_to_logs(ð_provider, state.block - 1, filter.clone());
|
subscribe_to_logs(ð_provider, filter.clone());
|
||||||
|
|
||||||
// if block in state is < current_block, get logs from that part.
|
// if block in state is < current_block, get logs from that part.
|
||||||
loop {
|
loop {
|
||||||
match eth_provider.get_logs(&filter) {
|
match eth_provider.get_logs(&filter.clone().from_block(state.block - 1)) {
|
||||||
Ok(logs) => {
|
Ok(logs) => {
|
||||||
for log in logs {
|
for log in logs {
|
||||||
match handle_log(&our, &mut state, &log) {
|
match handle_log(&our, &mut state, &log) {
|
||||||
@ -277,7 +276,7 @@ fn handle_eth_message(
|
|||||||
}
|
}
|
||||||
Err(_e) => {
|
Err(_e) => {
|
||||||
println!("got eth subscription error");
|
println!("got eth subscription error");
|
||||||
subscribe_to_logs(ð_provider, state.block - 1, filter.clone());
|
subscribe_to_logs(ð_provider, filter.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
use tokio::{fs, io::AsyncWriteExt, sync::Mutex};
|
use tokio::{fs, io::AsyncWriteExt, sync::Mutex};
|
||||||
|
|
||||||
include!("bootstrapped_processes.rs");
|
include!("../../target/bootstrapped_processes.rs");
|
||||||
|
|
||||||
pub async fn load_state(
|
pub async fn load_state(
|
||||||
our_name: String,
|
our_name: String,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lib"
|
name = "lib"
|
||||||
authors = ["KinodeDAO"]
|
authors = ["KinodeDAO"]
|
||||||
version = "0.8.3"
|
version = "0.8.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "A general-purpose sovereign cloud computing platform"
|
description = "A general-purpose sovereign cloud computing platform"
|
||||||
homepage = "https://kinode.org"
|
homepage = "https://kinode.org"
|
||||||
|
Loading…
Reference in New Issue
Block a user