From 7308c19cb1062fa245af4fce4bf0775e32c0798b Mon Sep 17 00:00:00 2001
From: hosted-fornet
Date: Fri, 23 Aug 2024 10:05:50 -0700
Subject: [PATCH 01/42] bump version to 0.9.2
---
Cargo.lock | 4 ++--
kinode/Cargo.toml | 2 +-
lib/Cargo.toml | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index e90bd38a..f4846462 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3526,7 +3526,7 @@ dependencies = [
[[package]]
name = "kinode"
-version = "0.9.1"
+version = "0.9.2"
dependencies = [
"aes-gcm",
"alloy 0.2.1",
@@ -3584,7 +3584,7 @@ dependencies = [
[[package]]
name = "kinode_lib"
-version = "0.9.1"
+version = "0.9.2"
dependencies = [
"lib",
]
diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml
index eb8d0272..67077b3e 100644
--- a/kinode/Cargo.toml
+++ b/kinode/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "kinode"
authors = ["KinodeDAO"]
-version = "0.9.1"
+version = "0.9.2"
edition = "2021"
description = "A general-purpose sovereign cloud computing platform"
homepage = "https://kinode.org"
diff --git a/lib/Cargo.toml b/lib/Cargo.toml
index 704ace6c..1374b73c 100644
--- a/lib/Cargo.toml
+++ b/lib/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "lib"
authors = ["KinodeDAO"]
-version = "0.9.1"
+version = "0.9.2"
edition = "2021"
description = "A general-purpose sovereign cloud computing platform"
homepage = "https://kinode.org"
From a843278ee97f5b0a746a3939b79e05f4c674c2fb Mon Sep 17 00:00:00 2001
From: hosted-fornet
Date: Fri, 23 Aug 2024 21:54:02 -0700
Subject: [PATCH 02/42] register: properly apply punycode conversion to
submitted name
---
Cargo.lock | 4 ++--
kinode/packages/app_store/app_store/src/utils.rs | 7 ++-----
.../src/register-ui/src/components/EnterKnsName.tsx | 12 ++++++------
kinode/src/register-ui/src/pages/CommitDotOsName.tsx | 4 +++-
4 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index f4846462..044df821 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3584,7 +3584,7 @@ dependencies = [
[[package]]
name = "kinode_lib"
-version = "0.9.2"
+version = "0.9.1"
dependencies = [
"lib",
]
@@ -3755,7 +3755,7 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
[[package]]
name = "lib"
-version = "0.9.1"
+version = "0.9.2"
dependencies = [
"alloy 0.2.1",
"kit 0.6.8",
diff --git a/kinode/packages/app_store/app_store/src/utils.rs b/kinode/packages/app_store/app_store/src/utils.rs
index e04e42b6..28264017 100644
--- a/kinode/packages/app_store/app_store/src/utils.rs
+++ b/kinode/packages/app_store/app_store/src/utils.rs
@@ -114,11 +114,8 @@ pub fn new_package(
let download_resp = serde_json::from_slice::(&resp.body())?;
- match download_resp {
- DownloadResponses::Error(e) => {
- return Err(anyhow::anyhow!("failed to add download: {:?}", e));
- }
- _ => {}
+ if let DownloadResponses::Error(e) = download_resp {
+ return Err(anyhow::anyhow!("failed to add download: {:?}", e));
}
Ok(())
}
diff --git a/kinode/src/register-ui/src/components/EnterKnsName.tsx b/kinode/src/register-ui/src/components/EnterKnsName.tsx
index 61bcd07d..728797e1 100644
--- a/kinode/src/register-ui/src/components/EnterKnsName.tsx
+++ b/kinode/src/register-ui/src/components/EnterKnsName.tsx
@@ -47,12 +47,6 @@ function EnterKnsName({
let validities: string[] = [];
setIsPunyfied('');
- const len = [...name].length;
- index = validities.indexOf(NAME_LENGTH);
- if (len < 9 && len !== 0) {
- if (index === -1) validities.push(NAME_LENGTH);
- } else if (index !== -1) validities.splice(index, 1);
-
let normalized = ''
index = validities.indexOf(NAME_INVALID_PUNY);
try {
@@ -62,6 +56,12 @@ function EnterKnsName({
if (index === -1) validities.push(NAME_INVALID_PUNY);
}
+ const len = [...normalized].length - 3;
+ index = validities.indexOf(NAME_LENGTH);
+ if (len < 9 && len !== 0) {
+ if (index === -1) validities.push(NAME_LENGTH);
+ } else if (index !== -1) validities.splice(index, 1);
+
if (normalized !== (name + ".os")) setIsPunyfied(normalized);
// only check if name is valid punycode
diff --git a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx
index 8cb8b97e..a422a247 100644
--- a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx
+++ b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx
@@ -1,5 +1,6 @@
import { useState, useEffect, FormEvent, useCallback } from "react";
import { Link, useNavigate } from "react-router-dom";
+import { toAscii } from "idna-uts46-hx";
import EnterKnsName from "../components/EnterKnsName";
import Loader from "../components/Loader";
import { PageProps } from "../lib/types";
@@ -66,6 +67,7 @@ function CommitDotOsName({
openConnectModal?.()
return
}
+ setName(toAscii(name));
console.log("committing to .os name: ", name)
const commitSecret = keccak256(stringToHex(name))
const commit = keccak256(
@@ -134,4 +136,4 @@ function CommitDotOsName({
);
}
-export default CommitDotOsName;
\ No newline at end of file
+export default CommitDotOsName;
From a1a69f0fa93d3e7a2bd4252efd4eb98fae666b25 Mon Sep 17 00:00:00 2001
From: Lyn <0xlynett@proton.me>
Date: Sat, 24 Aug 2024 15:31:46 +0100
Subject: [PATCH 03/42] use docker buildkit
---
README.md | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 5d3350fb..c79b5e53 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,6 @@
-
Kinode is a general-purpose sovereign cloud computer, built for crypto.
This repo contains the core runtime and processes.
@@ -17,10 +16,10 @@ Then follow the instructions to [install it](https://book.kinode.org/install.htm
If you have questions, join the [Kinode discord](https://discord.gg/TCgdca5Bjt) and drop us a line in `#dev-support`.
-
## Setup
On certain operating systems, you may need to install these dependencies if they are not already present:
+
- openssl-sys: https://docs.rs/crate/openssl-sys/0.9.19
- libclang 5.0: https://rust-lang.github.io/rust-bindgen/requirements.html
@@ -54,6 +53,7 @@ No security audits of this crate have ever been performed. This software is unde
Make sure not to use the same home directory for two nodes at once! You can use any name for the home directory: here we just use `home`. The `--` here separates cargo arguments from binary arguments.
TODO: document feature flags in `--simulation-mode`
+
```bash
# OPTIONAL: --release flag
cargo +nightly run -p kinode -- home
@@ -66,6 +66,7 @@ On boot you will be prompted to navigate to `localhost:8080` (or whatever HTTP p
By default, a node will use the [hardcoded providers](./kinode/src/eth/default_providers_mainnet.json) for the network it is booted on. A node can use a WebSockets RPC URL directly, or use another Kinode as a relay point. To adjust the providers a node uses, just create and modify the `.eth_providers` file in the node's home folder (set at boot). See the Kinode Book for more docs, and see the [default providers file here](./kinode/src/eth/default_providers_mainnet.json) for a template to create `.eth_providers`.
You may also add a RPC provider or otherwise modify your configuration by sending messages from the terminal to the `eth:distro:sys` process. You can get one for free at `alchemy.com`. Use this message format to add a provider -- this will make your node's performance better when accessing a blockchain:
+
```
m our@eth:distro:sys '{"AddProvider": {"chain_id": , "trusted": true, "provider": {"RpcUrl": ""}}}'
```
@@ -121,18 +122,18 @@ The `sys` publisher is not a real node ID, but it's also not a special case valu
- CTRL+R to search history, CTRL+R again to toggle through search results, CTRL+G to cancel search
- `m ''`: send an inter-process message. is formatted as @. is formatted as ::. JSON containing spaces must be wrapped in single-quotes (`''`).
- - Example: `m our@eth:distro:sys "SetPublic" -a 5`
- - the '-a' flag is used to expect a response with a given timeout
- - `our` will always be interpolated by the system as your node's name
+ - Example: `m our@eth:distro:sys "SetPublic" -a 5`
+ - the '-a' flag is used to expect a response with a given timeout
+ - `our` will always be interpolated by the system as your node's name
- `hi `: send a text message to another node's command line.
- - Example: `hi ben.os hello world`
+ - Example: `hi ben.os hello world`
- `top `: display kernel debugging info about a process. Leave the process ID blank to display info about all processes and get the total number of running processes.
- - Example: `top net:distro:sys`
- - Example: `top`
+ - Example: `top net:distro:sys`
+ - Example: `top`
- `cat `: print the contents of a file in the terminal
- - Example: `cat /terminal:sys/pkg/scripts.json`
+ - Example: `cat /terminal:sys/pkg/scripts.json`
- `echo `: print `text` to the terminal
- - Example: `echo foo`
+ - Example: `echo foo`
- `net_diagnostics`: print some useful networking diagnostic data
- `peers`: print the peers the node currently hold connections with
- `peer `: print the peer's PKI info, if it exists
@@ -146,9 +147,10 @@ The image includes EXPOSE directives for TCP port `8080` and TCP port `9000`. Po
If you are running a direct node, you must map port `9000` to the same port on the host and on your router. Otherwise, your Kinode will not be able to connect to the rest of the network as connection info is written to the chain, and this information is based on the view from inside the Docker container.
To build a local Docker image, run the following command in this project root.
+
```bash
# The `VERSION` may be replaced with the tag of a GitHub release
-docker build -t 0xlynett/kinode . --build-arg VERSION=v0.8.6
+docker buildx build -t 0xlynett/kinode . --build-arg VERSION=v0.9.1 --platform linux/amd64,linux/arm64
```
For example:
@@ -159,4 +161,4 @@ docker volume create kinode-volume
docker run -d -p 8080:8080 -it --name my-kinode \
--mount type=volume,source=kinode-volume,destination=/kinode-home \
0xlynett/kinode
-```
\ No newline at end of file
+```
From 09d537e9b03d5c529435c0d3dead415fa9f03220 Mon Sep 17 00:00:00 2001
From: bitful-pannul
Date: Mon, 26 Aug 2024 16:23:06 +0300
Subject: [PATCH 04/42] fakenet: reduce to 1 tx, wait for receipt
---
kinode/src/fakenet.rs | 69 ++++++++++++++++++++-----------------------
1 file changed, 32 insertions(+), 37 deletions(-)
diff --git a/kinode/src/fakenet.rs b/kinode/src/fakenet.rs
index 59a01641..0240eb29 100644
--- a/kinode/src/fakenet.rs
+++ b/kinode/src/fakenet.rs
@@ -58,38 +58,7 @@ pub async fn mint_local(
let provider: RootProvider = ProviderBuilder::default().on_ws(ws).await?;
- // interesting, even if we have a minted name, this does not explicitly fail.
- // also note, fake.dev.os seems to currently work, need to gate dots from names?
- let mint_call = mintCall {
- who: wallet_address,
- label: Bytes::from(label.as_bytes().to_vec()),
- initialization: vec![].into(),
- erc721Data: vec![].into(),
- implementation: Address::from_str(KINO_ACCOUNT_IMPL).unwrap(),
- }
- .abi_encode();
-
- let nonce = provider.get_transaction_count(wallet_address).await?;
-
- let tx = TransactionRequest::default()
- .to(minter)
- .input(TransactionInput::new(mint_call.into()))
- .nonce(nonce)
- .with_chain_id(31337)
- .with_gas_limit(12_000_00)
- .with_max_priority_fee_per_gas(200_000_000_000)
- .with_max_fee_per_gas(300_000_000_000);
-
- // Build the transaction using the `EthereumSigner` with the provided signer.
- let tx_envelope = tx.build(&wallet).await?;
-
- // Encode the transaction using EIP-2718 encoding.
- let tx_encoded = tx_envelope.encoded_2718();
-
- // Send the raw transaction and retrieve the transaction receipt.
- let _tx_hash = provider.send_raw_transaction(&tx_encoded).await?;
-
- // get tba to set KNS records
+ // get tba to see if name is already registered
let namehash: [u8; 32] = keygen::namehash(name);
let get_call = getCall {
@@ -149,30 +118,56 @@ pub async fn mint_local(
},
];
+ let is_reset = tba != Address::default();
+
let multicall = aggregateCall { calls: multicalls }.abi_encode();
- let execute_call = executeCall {
+ let execute_call: Vec = executeCall {
to: multicall_address,
value: U256::from(0), // free mint
data: multicall.into(),
- operation: 1, // ?
+ operation: 1,
}
.abi_encode();
+ let (input_bytes, to) = if is_reset {
+ // name is already registered, multicall reset it
+ (execute_call, tba)
+ } else {
+ // name is not registered, mint it with multicall in initialization param
+ (
+ mintCall {
+ who: wallet_address,
+ label: Bytes::from(label.as_bytes().to_vec()),
+ initialization: execute_call.into(),
+ erc721Data: vec![].into(),
+ implementation: Address::from_str(KINO_ACCOUNT_IMPL).unwrap(),
+ }
+ .abi_encode(),
+ minter,
+ )
+ };
+
let nonce = provider.get_transaction_count(wallet_address).await?;
let tx = TransactionRequest::default()
- .to(tba)
- .input(TransactionInput::new(execute_call.into()))
+ .to(to)
+ .input(TransactionInput::new(input_bytes.into()))
.nonce(nonce)
.with_chain_id(31337)
.with_gas_limit(12_000_00)
.with_max_priority_fee_per_gas(200_000_000_000)
.with_max_fee_per_gas(300_000_000_000);
+ // Build the transaction using the `EthereumSigner` with the provided signer.
let tx_envelope = tx.build(&wallet).await?;
+
+ // Encode the transaction using EIP-2718 encoding.
let tx_encoded = tx_envelope.encoded_2718();
- let _tx_hash = provider.send_raw_transaction(&tx_encoded).await?;
+
+ // Send the raw transaction and retrieve the transaction receipt.
+ let tx_hash = provider.send_raw_transaction(&tx_encoded).await?;
+ let _receipt = tx_hash.get_receipt().await?;
Ok(())
}
From be6b9321650a50f32592c42be46f3d733500fc8b Mon Sep 17 00:00:00 2001
From: bitful-pannul
Date: Mon, 26 Aug 2024 16:23:23 +0300
Subject: [PATCH 05/42] kns_indexer: optimistically handle notes
---
.../kns_indexer/kns_indexer/src/lib.rs | 25 ++++++++++++-------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs
index 4b93a38b..9cfffb1e 100644
--- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs
+++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs
@@ -433,15 +433,22 @@ fn handle_log(
if !kimap::valid_note(¬e) {
return Err(anyhow::anyhow!("skipping invalid note: {note}"));
}
- if let Some(block_number) = log.block_number {
- print_to_terminal(
- 1,
- &format!("adding note to pending_notes for block {block_number}"),
- );
- pending_notes
- .entry(block_number)
- .or_default()
- .push((decoded, 0));
+ // handle note: if it precedes parent mint event, add it to pending_notes
+ if let Err(e) = handle_note(state, &decoded) {
+ if let Some(KnsError::NoParentError) = e.downcast_ref::() {
+ if let Some(KnsError::NoParentError) = e.downcast_ref::() {
+ if let Some(block_number) = log.block_number {
+ print_to_terminal(
+ 1,
+ &format!("adding note to pending_notes for block {block_number}"),
+ );
+ pending_notes
+ .entry(block_number)
+ .or_default()
+ .push((decoded, 0));
+ }
+ }
+ }
}
}
_log => {
From 6ce5f25b3bd1c37b3e4c4616134173a7571353dd Mon Sep 17 00:00:00 2001
From: bitful-pannul
Date: Mon, 26 Aug 2024 16:35:39 +0300
Subject: [PATCH 06/42] app_store: fix fakenet
---
kinode/packages/app_store/chain/src/lib.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kinode/packages/app_store/chain/src/lib.rs b/kinode/packages/app_store/chain/src/lib.rs
index 0d596c54..88ea3e5d 100644
--- a/kinode/packages/app_store/chain/src/lib.rs
+++ b/kinode/packages/app_store/chain/src/lib.rs
@@ -38,7 +38,7 @@ const CHAIN_TIMEOUT: u64 = 60; // 60s
#[cfg(not(feature = "simulation-mode"))]
const KIMAP_ADDRESS: &'static str = kimap::KIMAP_ADDRESS; // optimism
#[cfg(feature = "simulation-mode")]
-const KIMAP_ADDRESS: &str = "0xcA92476B2483aBD5D82AEBF0b56701Bb2e9be658";
+const KIMAP_ADDRESS: &str = "0xEce71a05B36CA55B895427cD9a440eEF7Cf3669D";
const DELAY_MS: u64 = 1_000; // 1s
From 8e71caae41ee40c681f853e8587ce021856249fb Mon Sep 17 00:00:00 2001
From: bitful-pannul
Date: Mon, 26 Aug 2024 17:21:41 +0300
Subject: [PATCH 07/42] app_store UI: fix launch button on apppage
---
kinode/packages/app_store/ui/src/pages/AppPage.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kinode/packages/app_store/ui/src/pages/AppPage.tsx b/kinode/packages/app_store/ui/src/pages/AppPage.tsx
index b6700d9d..b7e6a9bc 100644
--- a/kinode/packages/app_store/ui/src/pages/AppPage.tsx
+++ b/kinode/packages/app_store/ui/src/pages/AppPage.tsx
@@ -95,7 +95,7 @@ export default function AppPage() {
};
const handleLaunch = () => {
- navigate(`/${app?.package_id.package_name}:${app?.package_id.package_name}:${app?.package_id.publisher_node}/`);
+ window.location.href = `/${app?.package_id.package_name}:${app?.package_id.package_name}:${app?.package_id.publisher_node}/`;
};
if (isLoading) {
From ae92859c919ffcbe0855cf49a905597efac7ef78 Mon Sep 17 00:00:00 2001
From: dr-frmr
Date: Mon, 26 Aug 2024 11:59:53 -0400
Subject: [PATCH 08/42] kns registration: disallow capital letters
---
kinode/packages/app_store/ui/package-lock.json | 2 --
kinode/src/register-ui/src/components/EnterKnsName.tsx | 10 +++++++++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/kinode/packages/app_store/ui/package-lock.json b/kinode/packages/app_store/ui/package-lock.json
index f65b58a3..54d87528 100644
--- a/kinode/packages/app_store/ui/package-lock.json
+++ b/kinode/packages/app_store/ui/package-lock.json
@@ -3749,8 +3749,6 @@
},
"node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": {
"version": "1.1.0",
- "resolved": "https://registry.npmjs.org/napi-wasm/-/napi-wasm-1.1.0.tgz",
- "integrity": "sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==",
"inBundle": true,
"license": "MIT"
},
diff --git a/kinode/src/register-ui/src/components/EnterKnsName.tsx b/kinode/src/register-ui/src/components/EnterKnsName.tsx
index 728797e1..4a755246 100644
--- a/kinode/src/register-ui/src/components/EnterKnsName.tsx
+++ b/kinode/src/register-ui/src/components/EnterKnsName.tsx
@@ -47,6 +47,12 @@ function EnterKnsName({
let validities: string[] = [];
setIsPunyfied('');
+ if (/[A-Z]/.test(name)) {
+ validities.push(NAME_URL);
+ setNameValidities(validities);
+ return;
+ }
+
let normalized = ''
index = validities.indexOf(NAME_INVALID_PUNY);
try {
@@ -69,7 +75,9 @@ function EnterKnsName({
index = validities.indexOf(NAME_URL);
if (name !== "" && !isValidDomain(normalized)) {
if (index === -1) validities.push(NAME_URL);
- } else if (index !== -1) validities.splice(index, 1);
+ } else if (index !== -1) {
+ validities.splice(index, 1);
+ }
index = validities.indexOf(NAME_CLAIMED);
From 9ece3e86f88b9eed87ce4a2e4b6d83fa624b8be6 Mon Sep 17 00:00:00 2001
From: bitful-pannul
Date: Mon, 26 Aug 2024 20:27:07 +0300
Subject: [PATCH 09/42] kns_indexer: typo
---
.../kns_indexer/kns_indexer/src/lib.rs | 20 +++++++++----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs
index 9cfffb1e..4716147c 100644
--- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs
+++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs
@@ -436,17 +436,15 @@ fn handle_log(
// handle note: if it precedes parent mint event, add it to pending_notes
if let Err(e) = handle_note(state, &decoded) {
if let Some(KnsError::NoParentError) = e.downcast_ref::() {
- if let Some(KnsError::NoParentError) = e.downcast_ref::() {
- if let Some(block_number) = log.block_number {
- print_to_terminal(
- 1,
- &format!("adding note to pending_notes for block {block_number}"),
- );
- pending_notes
- .entry(block_number)
- .or_default()
- .push((decoded, 0));
- }
+ if let Some(block_number) = log.block_number {
+ print_to_terminal(
+ 1,
+ &format!("adding note to pending_notes for block {block_number}"),
+ );
+ pending_notes
+ .entry(block_number)
+ .or_default()
+ .push((decoded, 0));
}
}
}
From 4f313af7c3da8d2106574d2ffba14960872ff872 Mon Sep 17 00:00:00 2001
From: bitful-pannul
Date: Mon, 26 Aug 2024 23:05:55 +0300
Subject: [PATCH 10/42] fakenet: test not waiting for receipt upon registration
---
kinode/src/fakenet.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kinode/src/fakenet.rs b/kinode/src/fakenet.rs
index 0240eb29..a2d9d60f 100644
--- a/kinode/src/fakenet.rs
+++ b/kinode/src/fakenet.rs
@@ -166,8 +166,7 @@ pub async fn mint_local(
let tx_encoded = tx_envelope.encoded_2718();
// Send the raw transaction and retrieve the transaction receipt.
- let tx_hash = provider.send_raw_transaction(&tx_encoded).await?;
- let _receipt = tx_hash.get_receipt().await?;
+ let _tx_hash = provider.send_raw_transaction(&tx_encoded).await?;
Ok(())
}
From 83ea1be8ba685e7137e978b1ecfd2eb31ca8d967 Mon Sep 17 00:00:00 2001
From: bitful-pannul
Date: Tue, 27 Aug 2024 00:32:42 +0300
Subject: [PATCH 11/42] kns_indexer: handle initial pending notes after boot
---
kinode/packages/kns_indexer/kns_indexer/src/lib.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs
index 4716147c..b41d4a2d 100644
--- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs
+++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs
@@ -154,6 +154,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
&mut pending_notes,
);
println!("done syncing old logs.");
+ handle_pending_notes(&mut state, &mut pending_notes)?;
loop {
let Ok(message) = await_message() else {
From 63ea699d186fd65e80bb1ae85c1af558936d7aab Mon Sep 17 00:00:00 2001
From: Lyn <0xlynett@proton.me>
Date: Mon, 26 Aug 2024 22:41:01 +0100
Subject: [PATCH 12/42] add support for multiarch builds
---
Dockerfile | 20 ++++++++++++--------
README.md | 7 ++++++-
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 2f1f5822..5496d4b2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,18 +1,22 @@
-FROM debian:12-slim AS downloader
+FROM --platform=$BUILDPLATFORM alpine AS downloader_start
ARG VERSION
-
+ARG TARGETARCH
WORKDIR /tmp/download
+RUN apk update && apk add unzip wget --no-cache
-RUN apt-get update
-RUN apt-get install unzip -y
-
+FROM downloader_start AS downloader_amd64
ADD "https://github.com/kinode-dao/kinode/releases/download/${VERSION}/kinode-x86_64-unknown-linux-gnu.zip" kinode-x86_64-unknown-linux-gnu.zip
RUN unzip kinode-x86_64-unknown-linux-gnu.zip
+FROM downloader_start AS downloader_arm64
+ADD "https://github.com/kinode-dao/kinode/releases/download/${VERSION}/kinode-aarch64-unknown-linux-gnu.zip" kinode-aarch64-unknown-linux-gnu.zip
+RUN unzip kinode-aarch64-unknown-linux-gnu.zip
+
+FROM downloader_${TARGETARCH} AS downloader
+
FROM debian:12-slim
-RUN apt-get update
-RUN apt-get install openssl -y
+RUN apt-get update && apt-get install openssl -y
COPY --from=downloader /tmp/download/kinode /bin/kinode
@@ -20,4 +24,4 @@ ENTRYPOINT [ "/bin/kinode" ]
CMD [ "/kinode-home" ]
EXPOSE 8080
-EXPOSE 9000
\ No newline at end of file
+EXPOSE 9000
diff --git a/README.md b/README.md
index c79b5e53..11464cb0 100644
--- a/README.md
+++ b/README.md
@@ -150,7 +150,12 @@ To build a local Docker image, run the following command in this project root.
```bash
# The `VERSION` may be replaced with the tag of a GitHub release
-docker buildx build -t 0xlynett/kinode . --build-arg VERSION=v0.9.1 --platform linux/amd64,linux/arm64
+
+# Build for your system's architecture
+docker build . -t 0xlynett/kinode --build-arg VERSION=v0.9.1
+
+# Build a multiarch image
+docker buildx build . --platform arm64,amd64 --build-arg VERSION=v0.9.1 -t 0xlynett/kinode
```
For example:
From 10cad4cbb2d8ed8c25c7847fde7b33f15b870994 Mon Sep 17 00:00:00 2001
From: hosted-fornet
Date: Mon, 26 Aug 2024 16:30:32 -0700
Subject: [PATCH 13/42] zip without timestamps
---
kinode/build.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kinode/build.rs b/kinode/build.rs
index 0ea04a5b..6be8af9c 100644
--- a/kinode/build.rs
+++ b/kinode/build.rs
@@ -136,7 +136,8 @@ fn build_and_zip_package(
let mut writer = Cursor::new(Vec::new());
let options = FileOptions::default()
.compression_method(zip::CompressionMethod::Deflated)
- .unix_permissions(0o755);
+ .unix_permissions(0o755)
+ .last_modified_time(zip::DateTime::from_date_and_time(1980, 1, 1, 0, 0, 0).unwrap());
{
let mut zip = zip::ZipWriter::new(&mut writer);
From 64af8909cccb08238fd7a88ec0a6ca98f54eeab1 Mon Sep 17 00:00:00 2001
From: hosted-fornet
Date: Mon, 26 Aug 2024 17:25:14 -0700
Subject: [PATCH 14/42] change build time to project kickoff day
---
kinode/build.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kinode/build.rs b/kinode/build.rs
index 6be8af9c..c20a663e 100644
--- a/kinode/build.rs
+++ b/kinode/build.rs
@@ -137,7 +137,7 @@ fn build_and_zip_package(
let options = FileOptions::default()
.compression_method(zip::CompressionMethod::Deflated)
.unix_permissions(0o755)
- .last_modified_time(zip::DateTime::from_date_and_time(1980, 1, 1, 0, 0, 0).unwrap());
+ .last_modified_time(zip::DateTime::from_date_and_time(2023, 6, 19, 0, 0, 0).unwrap());
{
let mut zip = zip::ZipWriter::new(&mut writer);
From 80b12e8d89161b654676493479d7296366839b7f Mon Sep 17 00:00:00 2001
From: dr-frmr
Date: Tue, 27 Aug 2024 11:52:12 +0200
Subject: [PATCH 15/42] feat: let user reset any node name, not just `.os`
---
kinode/src/register-ui/build.sh | 0
kinode/src/register-ui/src/App.tsx | 4 +--
.../src/components/EnterKnsName.tsx | 34 +++++++++++--------
.../register-ui/src/pages/CommitDotOsName.tsx | 2 +-
.../{ResetDotOsName.tsx => ResetName.tsx} | 7 ++--
5 files changed, 25 insertions(+), 22 deletions(-)
mode change 100644 => 100755 kinode/src/register-ui/build.sh
rename kinode/src/register-ui/src/pages/{ResetDotOsName.tsx => ResetName.tsx} (97%)
diff --git a/kinode/src/register-ui/build.sh b/kinode/src/register-ui/build.sh
old mode 100644
new mode 100755
diff --git a/kinode/src/register-ui/src/App.tsx b/kinode/src/register-ui/src/App.tsx
index 12b1ca7d..7f923270 100644
--- a/kinode/src/register-ui/src/App.tsx
+++ b/kinode/src/register-ui/src/App.tsx
@@ -6,7 +6,7 @@ import MintDotOsName from "./pages/MintDotOsName";
import MintCustom from "./pages/MintCustom";
import SetPassword from "./pages/SetPassword";
import Login from './pages/Login'
-import ResetDotOsName from './pages/ResetDotOsName'
+import ResetName from './pages/ResetName'
import KinodeHome from "./pages/KinodeHome"
import ImportKeyfile from "./pages/ImportKeyfile";
import { UnencryptedIdentity } from "./lib/types";
@@ -112,7 +112,7 @@ function App() {
} />
} />
} />
- } />
+ } />
} />
} />
} />
diff --git a/kinode/src/register-ui/src/components/EnterKnsName.tsx b/kinode/src/register-ui/src/components/EnterKnsName.tsx
index 4a755246..ba8dddcc 100644
--- a/kinode/src/register-ui/src/components/EnterKnsName.tsx
+++ b/kinode/src/register-ui/src/components/EnterKnsName.tsx
@@ -13,9 +13,10 @@ export const NAME_INVALID_PUNY = "Unsupported punycode character";
export const NAME_NOT_OWNER = "Name already exists and does not belong to this wallet";
export const NAME_NOT_REGISTERED = "Name is not registered";
-type ClaimOsNameProps = {
+type EnterNameProps = {
address?: `0x${string}`;
name: string;
+ fixedTlz?: string;
setName: React.Dispatch>;
nameValidities: string[];
setNameValidities: React.Dispatch>;
@@ -28,12 +29,13 @@ function EnterKnsName({
address,
name,
setName,
+ fixedTlz,
nameValidities,
setNameValidities,
triggerNameCheck,
setTba,
isReset = false,
-}: ClaimOsNameProps) {
+}: EnterNameProps) {
const client = usePublicClient();
const debouncer = useRef(null);
@@ -56,22 +58,24 @@ function EnterKnsName({
let normalized = ''
index = validities.indexOf(NAME_INVALID_PUNY);
try {
- normalized = toAscii(name + ".os");
+ normalized = toAscii(fixedTlz ? name + fixedTlz : name);
if (index !== -1) validities.splice(index, 1);
} catch (e) {
if (index === -1) validities.push(NAME_INVALID_PUNY);
}
- const len = [...normalized].length - 3;
- index = validities.indexOf(NAME_LENGTH);
- if (len < 9 && len !== 0) {
- if (index === -1) validities.push(NAME_LENGTH);
- } else if (index !== -1) validities.splice(index, 1);
+ if (fixedTlz === '.os') {
+ const len = [...normalized].length - 3;
+ index = validities.indexOf(NAME_LENGTH);
+ if (len < 9 && len !== 0) {
+ if (index === -1) validities.push(NAME_LENGTH);
+ } else if (index !== -1) validities.splice(index, 1);
+ }
- if (normalized !== (name + ".os")) setIsPunyfied(normalized);
+ if (normalized !== (fixedTlz ? name + fixedTlz : name)) setIsPunyfied(normalized);
// only check if name is valid punycode
- if (normalized && normalized !== '.os') {
+ if (normalized) {
index = validities.indexOf(NAME_URL);
if (name !== "" && !isValidDomain(normalized)) {
if (index === -1) validities.push(NAME_URL);
@@ -119,22 +123,22 @@ function EnterKnsName({
}, 500);
}, [name, triggerNameCheck, isReset]);
- const noDotsOrSpaces = (e: any) =>
- e.target.value.indexOf(".") === -1 && e.target.value.indexOf(" ") === -1 && setName(e.target.value);
+ const noSpaces = (e: any) =>
+ e.target.value.indexOf(" ") === -1 && setName(e.target.value);
return (
- .os
+ {fixedTlz && {fixedTlz}}
{nameValidities.map((x, i) => (
{x}
diff --git a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx
index a422a247..1f4568f6 100644
--- a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx
+++ b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx
@@ -52,7 +52,7 @@ function CommitDotOsName({
useEffect(() => setTriggerNameCheck(!triggerNameCheck), [address])
- const enterOsNameProps = { address, name, setName, nameValidities, setNameValidities, triggerNameCheck }
+ const enterOsNameProps = { address, name, setName, fixedTlz: ".os", nameValidities, setNameValidities, triggerNameCheck }
useEffect(() => {
if (!address) {
diff --git a/kinode/src/register-ui/src/pages/ResetDotOsName.tsx b/kinode/src/register-ui/src/pages/ResetName.tsx
similarity index 97%
rename from kinode/src/register-ui/src/pages/ResetDotOsName.tsx
rename to kinode/src/register-ui/src/pages/ResetName.tsx
index 31797e6b..db56a13b 100644
--- a/kinode/src/register-ui/src/pages/ResetDotOsName.tsx
+++ b/kinode/src/register-ui/src/pages/ResetName.tsx
@@ -36,7 +36,7 @@ function ResetKnsName({
const { data: hash, writeContract, isPending, isError, error } = useWriteContract({
mutation: {
onSuccess: (data) => {
- addRecentTransaction({ hash: data, description: `Reset KNS ID: ${name}.os` });
+ addRecentTransaction({ hash: data, description: `Reset KNS ID: ${name}` });
}
}
});
@@ -46,12 +46,11 @@ function ResetKnsName({
});
const addRecentTransaction = useAddRecentTransaction();
- const [name, setName] = useState(knsName.slice(0, -3));
+ const [name, setName] = useState(knsName);
const [nameValidities, setNameValidities] = useState([])
const [tba, setTba] = useState("");
const [triggerNameCheck, setTriggerNameCheck] = useState(false);
-
useEffect(() => {
document.title = "Reset";
}, []);
@@ -75,7 +74,7 @@ function ResetKnsName({
return;
}
- setKnsName(name + ".os");
+ setKnsName(name);
try {
const data = await generateNetworkingKeys({
From bd466e857e1fac9de1d6c5e0997ca08f14727f19 Mon Sep 17 00:00:00 2001
From: dr-frmr
Date: Tue, 27 Aug 2024 12:12:48 +0200
Subject: [PATCH 16/42] fix: attempt to simplify validity-checks
---
.../src/components/EnterKnsName.tsx | 82 ++++++++-----------
1 file changed, 33 insertions(+), 49 deletions(-)
diff --git a/kinode/src/register-ui/src/components/EnterKnsName.tsx b/kinode/src/register-ui/src/components/EnterKnsName.tsx
index ba8dddcc..aefa1171 100644
--- a/kinode/src/register-ui/src/components/EnterKnsName.tsx
+++ b/kinode/src/register-ui/src/components/EnterKnsName.tsx
@@ -1,5 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
-import isValidDomain from "is-valid-domain";
import { toAscii } from "idna-uts46-hx";
import { usePublicClient } from 'wagmi'
@@ -45,7 +44,6 @@ function EnterKnsName({
if (debouncer.current) clearTimeout(debouncer.current);
debouncer.current = setTimeout(async () => {
- let index: number;
let validities: string[] = [];
setIsPunyfied('');
@@ -56,67 +54,53 @@ function EnterKnsName({
}
let normalized = ''
- index = validities.indexOf(NAME_INVALID_PUNY);
try {
normalized = toAscii(fixedTlz ? name + fixedTlz : name);
- if (index !== -1) validities.splice(index, 1);
} catch (e) {
- if (index === -1) validities.push(NAME_INVALID_PUNY);
+ validities.push(NAME_INVALID_PUNY);
}
+ // length check, only for .os
if (fixedTlz === '.os') {
const len = [...normalized].length - 3;
- index = validities.indexOf(NAME_LENGTH);
if (len < 9 && len !== 0) {
- if (index === -1) validities.push(NAME_LENGTH);
- } else if (index !== -1) validities.splice(index, 1);
+ validities.push(NAME_LENGTH);
+ }
}
- if (normalized !== (fixedTlz ? name + fixedTlz : name)) setIsPunyfied(normalized);
+ if (normalized !== (fixedTlz ? name + fixedTlz : name)) {
+ setIsPunyfied(normalized);
+ }
- // only check if name is valid punycode
- if (normalized) {
- index = validities.indexOf(NAME_URL);
- if (name !== "" && !isValidDomain(normalized)) {
- if (index === -1) validities.push(NAME_URL);
- } else if (index !== -1) {
- validities.splice(index, 1);
- }
+ // only check ownership if name is otherwise valid
+ if (validities.length === 0 && normalized.length > 2) {
+ try {
+ const namehash = kinohash(normalized)
- index = validities.indexOf(NAME_CLAIMED);
+ const data = await client?.readContract({
+ address: KIMAP,
+ abi: kimapAbi,
+ functionName: "get",
+ args: [namehash]
+ })
- // only check if name is valid and long enough
- if (validities.length === 0 || index !== -1 && normalized.length > 2) {
- try {
- const namehash = kinohash(normalized)
- // maybe separate into helper function for readability?
- // also note picking the right chain ID & address!
- const data = await client?.readContract({
- address: KIMAP,
- abi: kimapAbi,
- functionName: "get",
- args: [namehash]
- })
-
- const tba = data?.[0];
- if (tba !== undefined) {
- setTba ? (setTba(tba)) : null;
- } else {
- validities.push(NAME_NOT_REGISTERED);
- }
-
- const owner = data?.[1];
- const owner_is_zero = owner === "0x0000000000000000000000000000000000000000";
-
- if (!owner_is_zero && !isReset) validities.push(NAME_CLAIMED);
-
- if (!owner_is_zero && isReset && address && owner !== address) validities.push(NAME_NOT_OWNER);
-
- if (isReset && owner_is_zero) validities.push(NAME_NOT_REGISTERED);
- } catch (e) {
- console.error({ e })
- if (index !== -1) validities.splice(index, 1);
+ const tba = data?.[0];
+ if (tba !== undefined) {
+ setTba ? (setTba(tba)) : null;
+ } else if (isReset) {
+ validities.push(NAME_NOT_REGISTERED);
}
+
+ const owner = data?.[1];
+ const owner_is_zero = owner === "0x0000000000000000000000000000000000000000";
+
+ if (!owner_is_zero && !isReset) validities.push(NAME_CLAIMED);
+
+ if (!owner_is_zero && isReset && address && owner !== address) validities.push(NAME_NOT_OWNER);
+
+ if (isReset && owner_is_zero) validities.push(NAME_NOT_REGISTERED);
+ } catch (e) {
+ console.error({ e })
}
}
setNameValidities(validities);
From fd04762ffb463e962defac85e85fe3f723018fc4 Mon Sep 17 00:00:00 2001
From: bitful-pannul
Date: Tue, 27 Aug 2024 18:09:31 +0300
Subject: [PATCH 17/42] fakenet: wait for receipt before booting
---
kinode/src/fakenet.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kinode/src/fakenet.rs b/kinode/src/fakenet.rs
index a2d9d60f..0240eb29 100644
--- a/kinode/src/fakenet.rs
+++ b/kinode/src/fakenet.rs
@@ -166,7 +166,8 @@ pub async fn mint_local(
let tx_encoded = tx_envelope.encoded_2718();
// Send the raw transaction and retrieve the transaction receipt.
- let _tx_hash = provider.send_raw_transaction(&tx_encoded).await?;
+ let tx_hash = provider.send_raw_transaction(&tx_encoded).await?;
+ let _receipt = tx_hash.get_receipt().await?;
Ok(())
}
From f963c3705ddd038cea79381cc316ef0d9d9eeea3 Mon Sep 17 00:00:00 2001
From: bitful-pannul
Date: Mon, 26 Aug 2024 18:57:08 +0300
Subject: [PATCH 18/42] app_store UI: dropdown choose package and publisher
---
.../ui/src/components/PackageSelector.tsx | 77 +++++++++++++++++++
.../app_store/ui/src/components/index.ts | 3 +-
.../app_store/ui/src/pages/PublishPage.tsx | 31 +++-----
3 files changed, 90 insertions(+), 21 deletions(-)
create mode 100644 kinode/packages/app_store/ui/src/components/PackageSelector.tsx
diff --git a/kinode/packages/app_store/ui/src/components/PackageSelector.tsx b/kinode/packages/app_store/ui/src/components/PackageSelector.tsx
new file mode 100644
index 00000000..7fc66743
--- /dev/null
+++ b/kinode/packages/app_store/ui/src/components/PackageSelector.tsx
@@ -0,0 +1,77 @@
+import React, { useState, useEffect } from 'react';
+import useAppsStore from "../store";
+
+interface PackageSelectorProps {
+ onPackageSelect: (packageName: string, publisherId: string) => void;
+}
+
+const PackageSelector: React.FC = ({ onPackageSelect }) => {
+ const { installed } = useAppsStore();
+ const [selectedPackage, setSelectedPackage] = useState("");
+ const [customPackage, setCustomPackage] = useState("");
+ const [isCustomPackageSelected, setIsCustomPackageSelected] = useState(false);
+
+ useEffect(() => {
+ if (selectedPackage && selectedPackage !== "custom") {
+ const [packageName, publisherId] = selectedPackage.split(':');
+ onPackageSelect(packageName, publisherId);
+ }
+ }, [selectedPackage, onPackageSelect]);
+
+ const handlePackageChange = (e: React.ChangeEvent) => {
+ const value = e.target.value;
+ if (value === "custom") {
+ setIsCustomPackageSelected(true);
+ } else {
+ setSelectedPackage(value);
+ setIsCustomPackageSelected(false);
+ setCustomPackage("");
+ }
+ };
+
+ const handleSetCustomPackage = () => {
+ if (customPackage) {
+ const [packageName, publisherId] = customPackage.split(':');
+ if (packageName && publisherId) {
+ onPackageSelect(packageName, publisherId);
+ setSelectedPackage(customPackage);
+ setIsCustomPackageSelected(false);
+ } else {
+ alert("Please enter the package name and publisher ID in the format 'packageName:publisherId'");
+ }
+ }
+ };
+
+ return (
+