Skip to content

Instantly share code, notes, and snippets.

View Wondertan's full-sized avatar

Hlib Kanunnikov Wondertan

View GitHub Profile
@Wondertan
Wondertan / square_header.go
Last active February 19, 2025 16:25
Proposal for the SquareHeader to be commited in VoteExtension
// SquareHeader has of which to be committed over during Vote Extension phase.
type SquareHeader struct {
// Basic information
Version cmtversion.Consensus `json:"version"` // different from BlockHeader/Proposal
ChainID string `json:"chain_id"` // different from BlockHeader/Proposal (like "square-chain") (why do we even need chain-id?)
Height int64 `json:"height"` // different from BlockHeader/Proposal (the chain forks at certain height and then both chains increment heights in their own pace)
Time time.Time `json:"time"` // copied over from BlockHeader/Proposal
// Consensus verification(copied over BlockHeader/Proposal)
NextValidatorsHash cmtbytes.HexBytes `json:"next_validators_hash"` // validators of the next block
@Wondertan
Wondertan / s2idle_report-2024-08-22.txt
Created August 22, 2024 19:22
Logs from amd_s2idle.py
2024-08-22 21:11:52,564 INFO: Debugging script for s2idle on AMD systems
2024-08-22 21:11:52,564 INFO: 💻 Framework Laptop 16 (AMD Ryzen 7040 Series) (16in Laptop) running BIOS 3.3 (03.03) released 03/27/2024 and EC unknown
2024-08-22 21:11:52,564 INFO: 🐧 Manjaro Linux
2024-08-22 21:11:52,564 INFO: 🐧 Kernel 6.6.46-1-MANJARO
2024-08-22 21:11:52,569 DEBUG: BAT1 charge level is 3505000 µAh
2024-08-22 21:11:52,569 INFO: 🔋 Battery BAT1 (NVT FRANDBA) is operating at 100.49% of design
2024-08-22 21:11:52,569 INFO: Checking prerequisites for s2idle
2024-08-22 21:11:52,569 INFO: ✅ Logs are provided via systemd
2024-08-22 21:11:52,570 INFO: ✅ AMD Ryzen 9 7940HS w/ Radeon 780M Graphics (family 19 model 74)
2024-08-22 21:11:52,570 DEBUG: SMT control: on
@Wondertan
Wondertan / concord.go
Last active May 6, 2023 20:56
Interfaces for heterogenous consensus algorigthms over p2p network.
// ProposalData is arbitrary data that Proposers agree on.
//
// Alternative names: consensus.Data, Contract, or can remove alias altogether.
type ProposalData = []byte
// ValidatorFunc validates the ProposalData and reports back to the Concord
// Q: Verify vs Validate? Quick googling suggests that Validate suits better, but might be wrong.
type ValidatorFunc func(context.Context, ProposalData) (bool, error)
// ProposeFunc builds ProposalData.

0x0d1aa45cebe24fccf683bc160329db30f7544e30e79712edeb75b4e4c5472a65

@Wondertan
Wondertan / pledge.service
Created June 11, 2021 12:41
Lotus Miner Auto Pledging Service
# /etc/systemd/system/pledge.service
[Unit]
Description=Lotus Miner Auto Pledging Service
Wants=lotus-miner.service
[Service]
User=lotus # or any other user
Type=oneshot
ExecStart=lotus-miner sectors pledge
Environment=LOTUS_MINER_PATH=/lotus/miner-repo # set miner repository accordingly to your setup
@Wondertan
Wondertan / pledge.timer
Last active June 11, 2021 12:44
Lotus Miner Auto Pledge `systemd` Timer
# /etc/systemd/system/pledge.timer
[Unit]
Description=Lotus Miner Auto Pledging Timer
[Timer]
OnUnitActiveSec=21min # Set the time that suits you harwdare the best.
# NOTE: You should also have enought funds for that, as pledging takes FILs for every produced sectors
# It requires having `pledge.service` in the same folder
# To start timer, manually fire `systemctl start pledge`
@Wondertan
Wondertan / lotus-worker-c2.service
Created June 11, 2021 12:36
Lotus C2 Worker `systemd` service.
# /etc/systemd/system/lotus-worker-c2.service
[Unit]
Description=Lotus C2 Worker Service
After=network.target
[Service]
User=lotus # or any other user
ExecStart=/usr/local/bin/lotus-worker run --no-local-storage --addpiece=false --precommit1=false --unseal=false --precommit2=false --commit=true --parallel-fetch-limit 10 --listen 192.168.88.105:3458
Restart=always
RestartSec=10
@Wondertan
Wondertan / lotus-worker-pc2.service
Last active January 1, 2022 01:17
Lotus Worker PC2 `systemd` Service
# /etc/systemd/system/lotus-worker-pc2.service
[Unit]
Description=Lotus PC2 Worker Service
After=network.target
[Service]
User=lotus # or any other user
ExecStart=/usr/local/bin/lotus-worker run --no-local-storage --addpiece=false --precommit1=false --unseal=false --precommit2=true --commit=false --parallel-fetch-limit 10 --listen 192.168.88.102:3456
Restart=always
RestartSec=10
@Wondertan
Wondertan / lotus-worker-pc1.service
Last active January 1, 2022 01:17
Lotus PC1 Worker `systemd` service.
# /etc/systemd/system/lotus-worker-pc1.service
[Unit]
Description=Lotus PC1 Worker Service
After=network.target
[Service]
User=lotus # or any other user
ExecStart=/usr/local/bin/lotus-worker run --no-local-storage --addpiece=false --precommit1=true --unseal=true --precommit2=false --commit=false --parallel-fetch-limit 10 --listen 192.168.88.106:3456
Restart=always
RestartSec=10
@Wondertan
Wondertan / lotus-miner.service
Last active January 1, 2022 01:17
Lotus Miner `systemd` Service
# /etc/systemd/system/lotus-miner.service
[Unit]
Description=Lotus Miner Service
After=network.target
After=lotus-daemon.service
Wants=lotus-daemon.service
[Service]
User=lotus # or any other user
ExecStart=/usr/local/bin/lotus-miner run