Commit Graph

287 Commits

Author SHA1 Message Date
parazyd
1297ff7b07 src/time: Implement and use {over,under}flow-safe API 2024-03-07 12:35:21 +01:00
parazyd
195c477caa chore: Clippy lints 2024-03-05 08:47:43 +01:00
skoupidi
7ac561fe67 util/time: TimeKeeper yeeted 2024-02-06 16:44:28 +02:00
skoupidi
f64c4e5750 contract/*: renamed all slot references to block height 2024-01-30 21:27:46 +02:00
parazyd
0e6f51e895 chore: Update copyright year in license headers 2024-01-16 13:07:22 +01:00
y
7c6f93c547 util-time: Add panic for overflow/underflow
Cause the timestamp functions with addition and subtraction to panic if
they would overflow. This helps to prevent logic issues. However, this
is potentially dangerous if the timestamp can be forced to overflow and
cause a panic; so, added TODOs as a note for future refactoring.
2023-12-11 10:46:26 -05:00
aggstam
8cff15a9b8 validator: handle proposals based on their version 2023-10-11 21:41:08 +03:00
y
6c1002a1ba timekeeper: improve wording about fields set to 0 2023-09-18 15:46:05 +00:00
y
63a6856ccd timekeeper: restore 0 check for slot 2023-09-18 15:46:05 +00:00
y
f67fc3df29 Add checks on TimeKeeperSafe methods 2023-09-18 15:46:05 +00:00
y
f85cd257a0 fix mistake in TimeKeeperSafe::current 2023-09-18 15:46:05 +00:00
y
6308a7e123 fix comments 2023-09-18 15:46:05 +00:00
y
5d62a10855 Add TimeKeeperSafe struct
Instead of checking if one of the TimeKeeper fields is 0 on every
operation (which adds overhead and protects only in the case of an
incoherent instantiation of the struct), add a new struct TimeKeeperSafe
that panics when created with bad values.

It is still possible that a developer can make a mistake and manually
initialize a TimeKeeper with bad values or else set its fields to bad
values. For now, we will accept this risk as it is not present in the
codebase.
2023-09-18 15:46:05 +00:00
y
c7814711e0 fmt 2023-09-18 15:46:05 +00:00
y
2f45588f57 util: fix division-by-zero panics
Added simple checks for division by zero in arithmetic operations in
util/time.rs
Added a unit test to check that a TimeKeeper with values of 0 in its
fields can call its methods without panicking.
2023-09-18 15:46:05 +00:00
parazyd
8fabd66160 research/snowball: Implement simulation of Snowball Avalanche consensus. 2023-09-05 12:24:04 +02:00
parazyd
70ff536034 util/ringbuffer: Implement indexing 2023-08-31 18:47:05 +02:00
x
662c9936c6 undo accidental commit to cli.rs 2023-08-30 13:59:49 +02:00
x
113978a6d4 darkirc: add p2p.get_info() 2023-08-30 13:27:06 +02:00
parazyd
ffe8643812 bin: Feature cleanup 2023-08-29 13:08:35 +02:00
parazyd
8f46f7b777 lib: Clean up library features. 2023-08-29 13:08:35 +02:00
parazyd
41bf60570a Implement standalone Makefiles for most of the bins and rework main Makefile. 2023-08-29 10:53:23 +02:00
parazyd
2d0e3b0d89 lib: Clean up imports 2023-08-24 15:29:16 +02:00
parazyd
98703d361a lib: Add necessary traits around for async serial. 2023-08-24 14:27:03 +02:00
x
f203b77281 Revert "bugfix: get_log_config(), the log level is set in TermLogger::new(), not in get_log_config() which simply controls the formatting."
This reverts commit 39db8099d9.
2023-08-23 09:41:58 +02:00
x
39db8099d9 bugfix: get_log_config(), the log level is set in TermLogger::new(), not in get_log_config() which simply controls the formatting. 2023-08-23 09:25:06 +02:00
parazyd
2b3859e194 util/parse: Delete unused truncate() function. 2023-08-22 19:59:51 +02:00
parazyd
a02e3475f6 lib: Remove async-std dependency. 2023-08-22 19:55:37 +02:00
parazyd
0f125fa2db net: Remove async-std dependency and prefer smol.
Also we now take the global executor and keep it around in P2p.
2023-08-22 15:07:48 +02:00
parazyd
21dd80ae99 rpc: Replace serde_json with tinyjson. 2023-08-20 18:53:52 +02:00
parazyd
1004b78ece util: Support conditional pretty-writing of JSON files. 2023-07-31 19:01:27 +02:00
parazyd
a4eb3e1e2b util/encoding: Add base64 encoder and decoder. 2023-07-27 10:58:20 +02:00
parazyd
d5b4cd9645 darkirc: Implement user modes and set +v for encrypted messages. 2023-07-19 18:23:32 +02:00
parazyd
bf2437ec2c util: Implement PCG for a deterministic PRNG used for testing and sim. 2023-07-19 13:56:56 +02:00
aggstam
9f81e693ed darkfid2/rpc: basic tx methods added 2023-07-18 19:00:52 +03:00
parazyd
968550a680 util: Clippy lints 2023-07-08 21:19:27 +02:00
aggstam
77067ac615 util/cli: fmt 2023-07-08 19:05:33 +03:00
aggstam
5d63d86083 chore: cleanup 2023-07-08 19:04:47 +03:00
parazyd
363a6cd998 vanityaddr: Remove indicatif dependency. 2023-07-08 18:01:23 +02:00
parazyd
ba25b08458 net: Add a function to map DnetInfo into a JSON map. 2023-07-08 16:21:49 +02:00
parazyd
021235b534 util/ringbuffer: Use const generic for size. 2023-07-08 16:21:49 +02:00
aggstam
a63a808992 util/cli/async_daemonize: use log_file to explicitly write to, impl signal handler using async signal hooks 2023-07-04 13:17:40 +03:00
parazyd
9102fbf33c util/ringbuffer: Implement back() method. 2023-06-29 13:06:54 +02:00
parazyd
0ac5d6026b util/cli: Make -v show the [INFO] log target, and -vv to actually debug.
Also disable file logging by default.
This needs to be done through config files.
2023-06-29 13:06:54 +02:00
aggstam
9054780c28 util/time/TimeKeeper: changed slot epoch calculation(increment by 1) 2023-06-06 23:51:36 +03:00
parazyd
08e92dbde3 util: Implement RingBuffer as exportable API 2023-06-06 16:09:30 +02:00
aggstam
53682169cd sdk: get_verifying_slot_epoch added 2023-06-05 21:59:39 +03:00
parazyd
6cddfac05f Replace num_cpus crate with stdlib alternative. 2023-05-19 09:59:55 +02:00
aggstam
1bd504eaa0 util/time/TimeKeeper: added verifying slot attribute that can be used by the runtime for validations 2023-05-17 16:03:24 +03:00
parazyd
6ff88f036a util: Remove net_name module. 2023-05-09 09:10:17 +02:00