Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
741afb5
register kimap name, set ip, pubkey and wsport
barraguda Jun 5, 2024
d18c7e8
Merge branch 'develop' into bp/kinomap
barraguda Jun 10, 2024
f8c28e2
kimap: update register flow
barraguda Jun 10, 2024
3c6e406
kimap: fix kns
barraguda Jun 10, 2024
3e0ab55
fakenet: kimap multicall
barraguda Jun 11, 2024
0ef56fc
kimap kns: rudimentary net updates
barraguda Jun 11, 2024
2aac98e
fakenet: modify port registration
barraguda Jun 13, 2024
37e7dde
kns_indexer -> kimap_indexer
barraguda Jun 13, 2024
cdb0525
hotfix: kimap_indexer manifest
barraguda Jun 13, 2024
aa6179b
hotfix2 kimap manifest.json
barraguda Jun 13, 2024
1da68b4
kimap: update contract addresses, app_store indexing
barraguda Jun 18, 2024
535a0ca
net: AddName, app_store & kns_indexer: update process_lib, integrations
barraguda Jun 19, 2024
d635732
app_store: add temp racecondition fix
barraguda Jun 19, 2024
a2333a7
app_store: combined note logic getting
barraguda Jun 19, 2024
ff89003
app_store: UI new connectors, abis, contracts
barraguda Jun 20, 2024
49215d7
app_store UI: remove ethers
barraguda Jun 20, 2024
0b05ea2
app_store: working on-parish
barraguda Jun 25, 2024
fe832b1
app_store: remove old events
barraguda Jun 25, 2024
afc1589
register_ui: start refactor...
barraguda Jun 25, 2024
ea0f652
register_ui: kimap register
barraguda Jun 27, 2024
c6d5ebe
register_ui: reset
barraguda Jun 27, 2024
ff00829
register_ui: further cleanup
barraguda Jun 27, 2024
ddf7889
kimap: subscribe to specific note events
barraguda Jun 28, 2024
fdb29d3
register: set password update, eip712
barraguda Jul 3, 2024
1ccf48c
register_ui: better reset
barraguda Jul 4, 2024
9cb1101
app_store: updates working, cleanup
barraguda Jul 4, 2024
8eb3ee4
register: full ip and port encoding
barraguda Jul 4, 2024
5d5dc67
move solidity functions and structs to sol.rs
barraguda Jul 4, 2024
1012ab1
ui updates
barraguda Jul 5, 2024
cc99136
kimap: switch to OP
barraguda Jul 5, 2024
497b1ac
app_store: new process_lib
barraguda Jul 5, 2024
93ffc18
Merge branch 'develop' into bp/kinomap
barraguda Jul 5, 2024
d87bdbf
better namehash, fix fakenet txs
barraguda Jul 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 113 additions & 69 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ members = [
"kinode/packages/chess/chess",
"kinode/packages/homepage/homepage",
"kinode/packages/kino_updates/widget",
"kinode/packages/kns_indexer/kns_indexer", "kinode/packages/kns_indexer/get_block", "kinode/packages/kns_indexer/state",
"kinode/packages/kimap_indexer/kimap_indexer", "kinode/packages/kimap_indexer/get_block", "kinode/packages/kimap_indexer/state",
"kinode/packages/settings/settings",
"kinode/packages/terminal/terminal",
"kinode/packages/terminal/alias", "kinode/packages/terminal/cat", "kinode/packages/terminal/echo", "kinode/packages/terminal/hi", "kinode/packages/terminal/kfetch", "kinode/packages/terminal/kill", "kinode/packages/terminal/m", "kinode/packages/terminal/top",
Expand Down
6 changes: 3 additions & 3 deletions kinode/packages/app_store/app_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ edition = "2021"
simulation-mode = []

[dependencies]
alloy-primitives = "0.7.0"
alloy-sol-types = "0.7.0"
alloy-primitives = "0.7.6"
alloy-sol-types = "0.7.6"
anyhow = "1.0"
bincode = "1.3.3"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.0" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "f8500a6" }
rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
16 changes: 6 additions & 10 deletions kinode/packages/app_store/app_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,16 @@ pub const VFS_TIMEOUT: u64 = 5; // 5s
pub const APP_SHARE_TIMEOUT: u64 = 120; // 120s

#[cfg(not(feature = "simulation-mode"))]
const CONTRACT_ADDRESS: &str = "0x52185B6a6017E6f079B994452F234f7C2533787B"; // optimism
const KIMAP_ADDRESS: &str = "0x7290Aa297818d0b9660B2871Bb87f85a3f9B4559"; // optimism
#[cfg(feature = "simulation-mode")]
const CONTRACT_ADDRESS: &str = "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"; // local
const KIMAP_ADDRESS: &str = "0x0165878A594ca255338adfa4d48449f69242Eb8F"; // note temp kimap address!

#[cfg(not(feature = "simulation-mode"))]
const CONTRACT_FIRST_BLOCK: u64 = 118_590_088;
const KIMAP_FIRST_BLOCK: u64 = 118_590_088;
#[cfg(feature = "simulation-mode")]
const CONTRACT_FIRST_BLOCK: u64 = 1;
const KIMAP_FIRST_BLOCK: u64 = 1;

const EVENTS: [&str; 3] = [
"AppRegistered(uint256,string,bytes,string,bytes32)",
"AppMetadataUpdated(uint256,string,bytes32)",
"Transfer(address,address,uint256)",
];
const EVENTS: [&str; 1] = ["Note(bytes32,bytes32,bytes,bytes,bytes)"];

// internal types

Expand Down Expand Up @@ -93,7 +89,7 @@ fn init(our: Address) {

http_api::init_frontend(&our);

println!("indexing on contract address {}", CONTRACT_ADDRESS);
println!("indexing on contract address {}", KIMAP_ADDRESS);

// create new provider with request-timeout of 60s
// can change, log requests can take quite a long time.
Expand Down
323 changes: 163 additions & 160 deletions kinode/packages/app_store/app_store/src/state.rs

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions kinode/packages/app_store/app_store/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use {
crate::kinode::process::main::OnchainMetadata,
crate::state::{AppStoreLogError, PackageState, SerializedState, State},
crate::{CONTRACT_ADDRESS, EVENTS, VFS_TIMEOUT},
crate::{
kinode::process::main::OnchainMetadata,
state::{AppStoreLogError, PackageState, SerializedState, State},
EVENTS, KIMAP_ADDRESS, VFS_TIMEOUT,
},
alloy_primitives::keccak256,
kinode_process_lib::{
eth, get_blob, get_state, http, kernel_types as kt, println, vfs, Address, LazyLoadBlob,
PackageId, ProcessId, Request,
},
std::collections::HashSet,
std::str::FromStr,
std::{collections::HashSet, str::FromStr},
};

// quite annoyingly, we must convert from our gen'd version of PackageId
Expand Down Expand Up @@ -58,26 +60,29 @@ pub fn fetch_state(our: Address, provider: eth::Provider) -> State {
if let Some(state_bytes) = get_state() {
match serde_json::from_slice::<SerializedState>(&state_bytes) {
Ok(state) => {
if state.contract_address == CONTRACT_ADDRESS {
if state.contract_address == KIMAP_ADDRESS {
return State::from_serialized(our, provider, state);
} else {
println!(
"state contract address mismatch! expected {}, got {}",
CONTRACT_ADDRESS, state.contract_address
KIMAP_ADDRESS, state.contract_address
);
}
}
Err(e) => println!("failed to deserialize saved state: {e}"),
}
}
State::new(our, provider, CONTRACT_ADDRESS.to_string()).expect("state creation failed")
State::new(our, provider, KIMAP_ADDRESS.to_string()).expect("state creation failed")
}

pub fn app_store_filter(state: &State) -> eth::Filter {
let notes = vec![keccak256("~metadata-uri"), keccak256("~metadata-hash")];

eth::Filter::new()
.address(eth::Address::from_str(&state.contract_address).unwrap())
.from_block(state.last_saved_block)
.events(EVENTS)
.topic3(notes)
Comment on lines 78 to +85
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is so cool

}

/// create a filter to fetch app store event logs from chain and subscribe to new events
Expand Down
3 changes: 2 additions & 1 deletion kinode/packages/app_store/pkg/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
],
"grant_capabilities": [
"eth:distro:sys",
"net:distro:sys",
"http_client:distro:sys",
"http_server:distro:sys",
"kns_indexer:kns_indexer:sys",
Expand All @@ -41,4 +42,4 @@
],
"public": false
}
]
]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading