Files
nym/validator-api/migrations/20210824120000_rewarding_data.sql
Jędrzej Stuczyński 020cad897d Feature/rust rewarding (#750)
* Calculating gas fees

* Ability to set custom fees

* Added extra test

* Removed commented code

* Moved all msg types to common contract crate

* Temporarily disabling get_tx method

* Finishing up nymd client API

* Comment fix

* Remaining fee values

* Some cleanup

* Removed needless borrow

* Fixed imports in contract tests

* Moved error types around

* New ValidatorClient

* Experiment with new type of defaults

* Removed dead module

* Dealt with unwrap

* Migrated mixnode to use new validator client

* Migrated gateway to use new validator client

* Mixnode and gateway adjustments

* More exported defaults

* Clients using new validator client

* Fixed mixnode upgrade

* Moved default values to a new crate

* Changed behaviour of validator client features

* Migrated basic functions of validator api

* Updated config + fixed startup

* Fixed wasm client build

* Integration with the explorer api

* Removed tokio dev dependency

* Needless borrow

* Fixex wasm client build

* Fixed tauri client build

* Needless borrows

* New tables for rewarding

* Updated cosmos-sdk version

* Removed reward-specific node status routes

* New rewarding-specific config entries

* Additional network defaults

* Initial periodic rewards from validator api

* Replaced print with log

* Filtering nodes with uptime > 0

* Additional failure logging statements

* Fixed operation ordering

* Adjusted next rewarding epoch determination

* Modified rewarding behaviour to keep track of rewarding in progress

* Improved error message on config load failure

* Additional log statement

* Adjusted rewarding gas limit calculation

* Made naming slightly more consistent

* Fixed incorrect parentheses placement

* Fixed fee calculation

* Cargo fmt

* Removed failed merge artifacts

* Introduced comment for any future reward modification

* typos

* Helper functions for the future

* Making @mfahampshire 's life easier

* Redesigned epoch + rewarding skipped epochs (if possible)

* Removed old merge artifacts

* Naming consistency

* Constraining arguments

* Removed unnecessary if branch

* Ignore monitor check for current epoch

* Additional checks for current epoch data

* Monitor threshold check

* cargo fmt

* Fixed post-merge issues in transactions.rs
2021-09-24 15:49:21 +01:00

74 lines
2.4 KiB
SQL

-- table to write information about any rewarding that has already begun
-- in case the process crashes during the procedure.
-- this would prevent people from somehow purposely crashing it and getting multiple rewards
-- per epoch
CREATE TABLE epoch_rewarding
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
epoch_timestamp INTEGER NOT NULL,
finished BOOLEAN NOT NULL
);
-- for each epoch there shall be a summary
CREATE TABLE rewarding_report
(
epoch_rewarding_id INTEGER NOT NULL,
eligible_mixnodes INTEGER NOT NULL,
eligible_gateways INTEGER NOT NULL,
possibly_unrewarded_mixnodes INTEGER NOT NULL,
possibly_unrewarded_gateways INTEGER NOT NULL,
FOREIGN KEY (epoch_rewarding_id) REFERENCES epoch_rewarding (id)
);
-- containing possibly many (ideally zero!) failed reward entries
-- (this refers to a reward chunk)
CREATE TABLE failed_mixnode_reward_chunk
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
error_message VARCHAR NOT NULL,
reward_summary_id INTEGER NOT NULL,
FOREIGN KEY (reward_summary_id) REFERENCES epoch_rewarding (id)
);
CREATE TABLE failed_gateway_reward_chunk
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
error_message VARCHAR NOT NULL,
reward_summary_id INTEGER NOT NULL,
FOREIGN KEY (reward_summary_id) REFERENCES epoch_rewarding (id)
);
-- and each such failed_mixnode_reward_chunk contain mixnodes that might have been unrewarded
-- (but we don't know for sure - at least in typescript we could have gotten a timeout yet the tx still was executed)
-- this table only exists because sqlite has no arrays
CREATE TABLE possibly_unrewarded_mixnode
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
identity VARCHAR NOT NULL,
uptime INTEGER NOT NULL,
failed_mixnode_reward_chunk_id INTEGER NOT NULL,
FOREIGN KEY (failed_mixnode_reward_chunk_id) REFERENCES failed_mixnode_reward_chunk (id)
);
CREATE TABLE possibly_unrewarded_gateway
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
identity VARCHAR NOT NULL,
uptime INTEGER NOT NULL,
failed_gateway_reward_chunk_id INTEGER NOT NULL,
FOREIGN KEY (failed_gateway_reward_chunk_id) REFERENCES failed_gateway_reward_chunk (id)
)