Files
de-mls/frontend/.netlify/server/entries/pages/_page.svelte.js
Ekaterina Broslavskaya 4ea1136012 chore: implement consensus mechanism (#43)
* chore: implement consensus mechanism

- Updated `Cargo.lock`
- Refactored `Cargo.toml`
- Enhanced `action_handlers.rs` to introduce a ban request feature, allowing users to send ban requests through Waku.
- Implemented a new consensus module to manage proposal and voting processes, including state transitions for steward epochs.
- Updated error handling in `error.rs` to accommodate new consensus-related errors.
- Refactored `group.rs` and `user_actor.rs` to integrate the new consensus logic and improve state management.
- Added tests for the consensus mechanism to ensure reliability and correctness of the voting process.

* chore: update dependencies and refactor code for clarity

* refactor: update voting mechanism and clean up user actor logic

- Changed the return type of `complete_voting_for_steward` to return a vector of messages instead of a boolean.
- Removed unused request types and their implementations related to proposal handling.
- Updated the `handle_steward_flow_per_epoch` function to reflect changes in the voting process and improved logging.
- Refactored tests to align with the new voting mechanism and ensure proper message handling.
- Enhanced consensus logic to better handle vote counting and state transitions.

* feat: implement real voting for all users

- Improved logging messages for clarity during WebSocket message handling.
- Added new serverless functions and shims for better integration with the frontend.
- Introduced new manifest files for server configuration and routing.
- Implemented initial setup for handling user votes and proposals in the consensus mechanism.
- Updated error handling to accommodate new user vote actions and related messages.

* consensus: update test

* Enhance steward state management and consensus mechanism

- Added detailed documentation in README for steward state management, including state definitions, transitions, and flow scenarios.
- Updated `WakuNode` connection logic to include a timeout for peer connections.
- Refactored message handling in `action_handlers.rs` to utilize new `AppMessage` structures for improved clarity.
- Enhanced error handling in `error.rs` to cover new scenarios related to consensus and state transitions.
- Updated tests to reflect changes in the consensus mechanism and steward flow, ensuring robustness and reliability.
- Improved state machine logic to handle edge cases and guarantee proper state transitions during steward epochs.

* Refactor

- Updated `WakuMessageToSend` constructor to accept a slice for `app_id`, improving memory efficiency.
- Enhanced error handling in `Group` struct to provide more descriptive error messages for invalid states.
- Added detailed documentation for new methods in `Group` and `User` structs, clarifying their functionality and usage.
- Refactored state machine logic to ensure proper transitions during steward epochs and voting processes.
- Improved test coverage for group state management and message processing, ensuring robustness in various scenarios.

* Update README for improved clarity and formatting

* fix: fix lint issues and updates test flow

* test: update user test
2025-09-10 16:42:43 +03:00

40 lines
2.7 KiB
JavaScript

import { c as create_ssr_component, e as escape, i as each, g as add_attribute } from "../../chunks/index3.js";
import "../../chunks/Toaster.svelte_svelte_type_style_lang.js";
const Page = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let status, rooms;
let { data } = $$props;
let eth_pk = "";
let room = "";
let create_new_room = false;
const filled_in = () => {
return !(eth_pk.length > 0 && room.length > 0);
};
if ($$props.data === void 0 && $$bindings.data && data !== void 0)
$$bindings.data(data);
({ status, rooms } = data);
return `<div class="flex flex-col justify-center"><div class="title"><h1 class="text-3xl font-bold text-center">Chatr: a Websocket chatroom</h1></div>
<div class="join self-center"></div>
<div class="rooms self-center my-5"><div class="flex justify-between py-2"><h2 class="text-xl font-bold ">List of active chatroom&#39;s
</h2>
<button class="btn btn-square btn-sm btn-accent">↻</button></div>
${status && rooms.length < 1 ? `<div class="card bg-base-300 w-96 shadow-xl text-center"><div class="card-body"><h3 class="card-title ">${escape(status)}</h3></div></div>` : ``}
${rooms ? `${each(rooms, (room2) => {
return `<button class="card bg-base-300 w-96 shadow-xl my-3 w-full"><div class="card-body"><div class="flex justify-between"><h2 class="card-title">${escape(room2)}</h2>
<button class="btn btn-primary btn-md">Select Room</button>
</div></div>
</button>`;
})}` : ``}</div>
<div class="create self-center my-5 w-[40rem]"><div><label class="label" for="eth-private-key"><span class="label-text">Eth Private Key</span></label>
<input id="eth-private-key" placeholder="Eth Private Key" class="input input-bordered input-primary w-full bg-base-200 mb-4 mr-3"${add_attribute("value", eth_pk, 0)}></div>
<div><label class="label" for="room-name"><span class="label-text">Room name</span></label>
<input id="room-name" placeholder="Room Name" class="input input-bordered input-primary w-full bg-base-200 mb-4 mr-3"${add_attribute("value", room, 0)}></div>
<div class="form-control"><label class="label cursor-pointer"><span class="label-text">Create Room</span>
<input type="checkbox" class="checkbox checkbox-primary"${add_attribute("checked", create_new_room, 1)}></label></div>
<button class="btn btn-primary" ${filled_in() ? "disabled" : ""}>Join Room.</button></div>
<div class="github self-center"><p>Check out <a class="link link-accent" href="https://github.com/0xLaurens/chatr" target="_blank" rel="noreferrer">Chatr</a>, to view the source code!
</p></div></div>`;
});
export {
Page as default
};