Skip to content

Commit adfde36

Browse files
committed
problem: many lines are too long: solution: lint.
1 parent 766117d commit adfde36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1645
-1322
lines changed

README.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,69 @@ Problem: spaceman is not maintainable and it's getting annoying
66
npm install
77
npm run dev
88
```
9+
910
## Contributing
11+
1012
Please avoid ambiguity over Types: use TypeScript and avoid plain untyped JS.
1113

12-
When returning multiple values and one of those values is an indication of validation, put it **last** in the list:
14+
When returning multiple values and one of those values is an indication of validation, put it **last** in the list:
15+
1316
```
14-
//rocketIgnitionEvent takes a state change request event and the current state;
17+
//rocketIgnitionEvent takes a state change request event and the current state;
1518
//returns the new state and a boolean indicating successful state change
1619
//function rocketIgnitionEvent(ev: NDKEvent, state: Nostrocket): [Nostrocket, boolean]
1720
```
1821

19-
2022
## Terminology
21-
**note**: a nostr event.
2223

23-
**State Change Request**: a *note* requesting a change to the current nostrocket state, for example a Merit Request, logging a Problem, adding a pubkey to the Identity Tree, etc.
24+
**note**: a nostr event.
2425

25-
**Consensus Chain**: a linked list of notes called [Consensus Notes](https://github.com/nostrocket/NIPS/blob/main/Rockets.md#consensus-event). Each note in the list points (with a labelled `e` tag) to at least one *State Change Request*. We build our local state by parsing these State Change Requests against the Nostrocket Unprotocol.
26+
**State Change Request**: a _note_ requesting a change to the current nostrocket state, for example a Merit Request, logging a Problem, adding a pubkey to the Identity Tree, etc.
2627

27-
**Hard State**: this is the state which exists as a [Consensus Chain](https://github.com/nostrocket/NIPS/blob/main/Rockets.md#consensus-over-state) and SHOULD be eventually consistent across all participant's instances of a Rocket.
28+
**Consensus Chain**: a linked list of notes called [Consensus Notes](https://github.com/nostrocket/NIPS/blob/main/Rockets.md#consensus-event). Each note in the list points (with a labelled `e` tag) to at least one _State Change Request_. We build our local state by parsing these State Change Requests against the Nostrocket Unprotocol.
2829

29-
A *State Change Request* that indends to modify *Hard State* only does so when someone with *Votepower* within that particular Rocket includes it in their *Consensus Chain*.
30+
**Hard State**: this is the state which exists as a [Consensus Chain](https://github.com/nostrocket/NIPS/blob/main/Rockets.md#consensus-over-state) and SHOULD be eventually consistent across all participant's instances of a Rocket.
3031

31-
This type of state should be used sparingly. Any state that doesn't require a high degree of consensus among participants should *not* use Hard State.
32+
A _State Change Request_ that indends to modify _Hard State_ only does so when someone with _Votepower_ within that particular Rocket includes it in their _Consensus Chain_.
3233

33-
Hard State is currently used for state that is in the critical path to Votepower: Rocket creation; Merit requests, votes on merit requests, transfer of merits to other pubkeys.
34+
This type of state should be used sparingly. Any state that doesn't require a high degree of consensus among participants should _not_ use Hard State.
3435

35-
**Hard State Change Request** is a *State Change Request* intended to modify *Hard State*.
36+
Hard State is currently used for state that is in the critical path to Votepower: Rocket creation; Merit requests, votes on merit requests, transfer of merits to other pubkeys.
3637

37-
**Soft State**: There is no consensus over this state and it is not included in a Consensus Chain, but it can be considered *eventually consistent enough* for most nostrocket activity. Examples of where it's currently used: Identity Tree, Problem Tracker (logging new problems, modifying problems, etc).
38+
**Hard State Change Request** is a _State Change Request_ intended to modify _Hard State_.
3839

39-
**Soft State Change Request** is a *State Change Request* intended to modify *Soft State*.
40+
**Soft State**: There is no consensus over this state and it is not included in a Consensus Chain, but it can be considered _eventually consistent enough_ for most nostrocket activity. Examples of where it's currently used: Identity Tree, Problem Tracker (logging new problems, modifying problems, etc).
4041

41-
**Session State**: This is for convenience only, it is local to the browser and not persisted as notes. The only current example of this in nostrocket is the current user's profile, which we use for producing notes etc.
42+
**Soft State Change Request** is a _State Change Request_ intended to modify _Soft State_.
4243

44+
**Session State**: This is for convenience only, it is local to the browser and not persisted as notes. The only current example of this in nostrocket is the current user's profile, which we use for producing notes etc.
4345

4446
## How it fits together
47+
4548
All Nostrocket notes SHOULD point to `note1r0cketrztzx06l3uxd4c2j86fxsfvfls8klsd3aylm38hsqewtyqyp7wj7` so they can be found easily.
4649

4750
Hard State begins with a `kind 15171031` [Rocket Ignition Event](https://github.com/nostrocket/NIPS/blob/main/Rockets.md). Nostrocket itself is a Rocket created by one of these events.
4851

49-
The pubkey that signs a Rocket Ignition Event is called the *Ignition Pubkey*. The Ignition Pubkey that creates a new Rocket always begins with a Votepower of `1` (only applicable within that particular Rocket).
52+
The pubkey that signs a Rocket Ignition Event is called the _Ignition Pubkey_. The Ignition Pubkey that creates a new Rocket always begins with a Votepower of `1` (only applicable within that particular Rocket).
5053

5154
As the Ignition Pubkey is the only pubkey with Votepower when a new Rocket is created, anyone wanting to view the current Hard State for that particular Rocket should begin by following this pubkey's Consensus Chain, adding and removing further pubkeys along the way as the state of the Rocket changes (the client does this automagically). For additional mallorysistance, users can add their Bitcoin node details to validate OP_RETURNS signed by pubkeys with votepower.
5255

53-
Before adding State Change Requests to their Consensus Chain, a pubkey with votepower MUST validate the request against the Nostrocket Unprotocol (encoded into Oxygen logic) within the context of the current global Hard State AND their current subjective view of Soft State.
56+
Before adding State Change Requests to their Consensus Chain, a pubkey with votepower MUST validate the request against the Nostrocket Unprotocol (encoded into Oxygen logic) within the context of the current global Hard State AND their current subjective view of Soft State.
5457

55-
Thus, while there's no consensus over Soft State, it's still somewhat relevant (but not critical) to consensus over Hard State.
58+
Thus, while there's no consensus over Soft State, it's still somewhat relevant (but not critical) to consensus over Hard State.
5659

5760
Soft State is simply updated by Soft State Change Requests if they pass local validation after being received from a Relay. This validation can involve validation against the Nostrocket Unprotocol, the current Hard and Soft state, and user settings.
5861

5962
## Note Sources and Routing
60-
Everything in Oxygen is *Note driven*. These notes come from relays, and are handled differently depending on whether they are *Consensus Notes*, *Hard State Change Requests*, or *Soft State Change Requests*.
6163

62-
First, we subscribe to all Relays using all relevant filters. Then we buffer, route, and handle the incoming notes appropriately.
64+
Everything in Oxygen is _Note driven_. These notes come from relays, and are handled differently depending on whether they are _Consensus Notes_, _Hard State Change Requests_, or _Soft State Change Requests_.
65+
66+
First, we subscribe to all Relays using all relevant filters. Then we buffer, route, and handle the incoming notes appropriately.
6367

64-
We take the stream of notes from our Relays, filter out anything that doesn't look valid, and buffer the result in mempool.
68+
We take the stream of notes from our Relays, filter out anything that doesn't look valid, and buffer the result in mempool.
6569

6670
### Hard State
71+
6772
We listen to the mempool for any valid Consensus Notes (signed by a pubkey with votepower in our current Hard State AND points to that pubkey's last Consensus Note for that particular Rocket). We find the Hard State Change Request that this Consensus Note has included in an `e` tag with the label `request`, and then we fetch that Note from mempool (it SHOULD be in mempool). We handle that Hard State Change Request. If it fails, we halt and catch fire. If the currently logged in user has votepower, we publish Consensus Events to add these Hard State Change Events to our own Consensus Chain at this time.
6873

6974
We keep repeating this until there are no new Consensus Notes. Each pubkey can also publish their latest Consensus Note ID and height in a replaceable event so that we know when we've reached the tip. We keep listening for these Consensus Notes and handle them whenever they come in.
@@ -73,10 +78,11 @@ The **Consensus Lead** is the pubkey with the highest Votepower from the set of
7378
If we (the currently logged in user) has the Consensus Lead, then once we've reached the current tip of a valid Consensus Chain, we start producing Consensus Events to add any waiting Hard State Change Requests (in mempool) to our Consensus Chain (after validating them of course). We do not update our local state directly during this process, we instead wait for our own Consensus Notes to arrive from a Relay and handle them as per the above. This is to keep the logic all in the same place and make things more simple.
7479

7580
### Soft State
81+
7682
We can handle Soft State Change Requests asynchronously in the background at the same time as Hard State Change Requests.
7783

7884
We listen to mempool for all seeminlgy valid Soft State Change Requests, and simply handle them by validating them against the Nostrocket Unprotocol in the context of the current Hard and Soft state.
7985

8086
### Best Practices
81-
* If a Note sucessfully causes any kind of State to change, remove it from our mempool, and add it to a list (or cuckoo filter) of notes that have been handled, so that we don't handle them more than once.
82-
87+
88+
- If a Note sucessfully causes any kind of State to change, remove it from our mempool, and add it to a list (or cuckoo filter) of notes that have been handled, so that we don't handle them more than once.

postcss.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ export default {
33
tailwindcss: {},
44
autoprefixer: {},
55
},
6-
}
6+
};

src/components/elements/Profile.svelte

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
}
1919
}
2020
</script>
21+
2122
<Column max={4} lg={4} md={4} sm={16} aspectRatio="2x1">
2223
<Row style="height:99%;padding:2px;">
2324
<Tile style="width:100%; height:100%;overflow:hidden;">
@@ -26,13 +27,13 @@
2627
<AspectRatio ratio="1x1" style="width:100%;">
2728
<Tile light>
2829
<a href="https://nostr.band/?q={profile.npub}">
29-
<div style="text-align:center;overflow:hidden;">
30-
<h6>{profile.profile?.name}</h6>
31-
</div>
32-
<div style="margin:2%;">
33-
<ImageLoader fadeIn ratio="1x1" src={avatarUrl} />
34-
</div>
35-
</a>
30+
<div style="text-align:center;overflow:hidden;">
31+
<h6>{profile.profile?.name}</h6>
32+
</div>
33+
<div style="margin:2%;">
34+
<ImageLoader fadeIn ratio="1x1" src={avatarUrl} />
35+
</div>
36+
</a>
3637
<!-- <img src={profile.profile?.image} width="100%" height="auto" alt="[profile pic here]"> -->
3738
<!-- <Avatar ndk={$ndk} user={profile}/> -->
3839
</Tile>

0 commit comments

Comments
 (0)