Commit Graph

3537 Commits

Author SHA1 Message Date
aggstam
2edadbc214 darkirc: update event_graph synced flag when we were already on latest tip 2023-12-08 17:56:13 +02:00
aggstam
f1096838ac darkirc: update event_graph synced flag when we skip sync 2023-12-08 14:37:19 +02:00
aggstam
c6fa3ba99b event_graph: introduce layers to the DAG
Each event corresponds to a specific layer(height) in the dag, making identifying and preventing cycles way easier, as all parents must exist in previous layers. Additionally, propagation and sync gremlins have been eliminated, and proper validations added
2023-11-24 15:35:35 +02:00
parazyd
59d7ed09fc contract/deployooor: Clippy lint 2023-11-24 12:16:34 +01:00
parazyd
69cfa99860 contract/deployooor: Validate webassembly binary and search for needed symbols 2023-11-24 12:13:51 +01:00
parazyd
7e0ffd41cd net/settings: Use Settings::default() in SettingsOpt
This simplifies making default changes since now have to be done only once.
2023-11-24 11:18:47 +01:00
y
c6d9e495e8 [runtime/vm_runtime] Clarify comment for call()
Make it clear that it is only possible to use a "ContractSection" method
when making a call to `call()`.
2023-11-23 10:24:21 -05:00
y
6cff3c3a12 [runtime/vm_runtime] Add even more documentation 2023-11-23 10:00:58 -05:00
y
4f29180d9e [runtime/vm_runtime] Add more documentation 2023-11-22 14:05:01 -05:00
y
78196dbdd2 [runtime/merke] Document method merkle_add() 2023-11-22 11:43:41 -05:00
y
d4b8d45b74 [runtime/util] Document methods 2023-11-22 11:15:27 -05:00
y
fd643a8d08 [validator/validation] Improve comment wording 2023-11-22 10:48:44 -05:00
y
dd471e6b06 [validator/validation] Typo and comment formatting 2023-11-22 10:22:41 -05:00
aggstam
4d3984a611 validator: renamed testing_mode to pos_testing_mode 2023-11-22 00:26:22 +02:00
ertosns
6e830b386a [src/runtime] add link to open issue unstable cursor_reamining 2023-11-22 00:25:04 +02:00
ertosns
0d05fe6ebe [src/runtime] rename db_handle:u32 2023-11-22 00:25:04 +02:00
y
1ffcaba5aa [validator/verication] Revert additional changes
Commit a0636984e4 is reverted a previous
commit. There were a few relevant variables that were mistakenly changed
in a previous commit and no longer pass clippy. This commit makes clippy
happy.
2023-11-21 17:16:01 -05:00
y
d70dc7da65 Revert "[validator/verification] Reject massive txs"
This reverts commit a0636984e4.
2023-11-21 17:13:22 -05:00
y
a0636984e4 [validator/verification] Reject massive txs
Add a check in verify_transaction() to reject transactions that have a
number of calls greater than the GAS_LIMIT defined in the runtime.

This prevents a potential denial-of-service vector where an attacker
could submit extremely large transactions that are guaranteed to revert
but still tie up system resources before the revert happens.
2023-11-21 16:24:17 -05:00
y
b4746761d2 [validator/verification] fix index out of bounds 2023-11-21 15:59:29 -05:00
y
6461facaaa [validator/verification] Fix typo in code comment
Change 'version 1' to 'version 2' where the Rust code matches
block_version == 2.
2023-11-21 15:32:18 -05:00
y
a649d8f434 [runtime] Handle calls with no return values
This commit handles cases where the wasm functions had no return values.

- The code has been rewritten to avoid potential index out of bounds
errors when the `ret` variable could have had a length of zero
- Added new debug message to signal when a contract has returned no
  values, but this is expected and desirable
- Add code comments
2023-11-21 11:32:26 -05:00
y
d3839ed6fc [runtime] Prevent (unlikely) underflow
This commit explicitly handles a scenario where an underflow could
occur when calculating gas. In practice, this should not occur as the
WASM points budget should be synchronized with the contract's gas usage.
For this reason, the code should panic instead of underflow if this does
somehow happen.
2023-11-21 11:32:26 -05:00
y
889478f561 [runtime] Add clarifying documentation 2023-11-21 11:32:26 -05:00
ertosns
2e057cdca4 [src/serial] added vec, neg unit tests 2023-11-21 17:22:06 +02:00
parazyd
673b0ec6b1 Full Makefile project cleanup 2023-11-21 15:58:08 +01:00
parazyd
64e54f933e tx: impl_p2p_message for Transaction when "net" feature is defined. 2023-11-21 15:58:08 +01:00
parazyd
a652375b08 contract: Clean up Makefiles 2023-11-21 15:58:05 +01:00
aggstam
7834a3f800 validator/pow: added fixed_difficulty greater than zero shield 2023-11-21 15:43:10 +02:00
aggstam
61d262880d chore: clippy 2023-11-21 14:56:38 +02:00
aggstam
cb06356c46 validator/pow: introduced fixed difficulty for testing purposes 2023-11-21 14:41:56 +02:00
parazyd
e589fc0b2b rpc: Simplify stream reading and move timeouts to outer scope. 2023-11-21 10:37:38 +01:00
parazyd
9066e55f00 rpc: Read byte-by-byte from stream and properly handle lines.
This wraps the reader side into a BufReader and read_from_stream now
reads byte-by-byte from the stream using an intermediate buffer.
The BufReader doc[0] claims that using this for such reading operation
is advantageous and useful for small and repeated reads to a socket.

read_from_stream stops reading after reaching LF, and optionally pops
CR from the back of the buffer to handle CRLF endings.

[0] https://docs.rs/smol/latest/smol/io/struct.BufReader.html
2023-11-20 11:36:43 +01:00
parazyd
26ee5897cf rpc: Use CRLF for line endings in the protocol.
Reading still supports LF-only, but generally the protocol should use CRLF.
2023-11-20 10:21:48 +01:00
x
d7c3ac140e fix money_xfer pow-reward unit test 2023-11-20 10:10:33 +01:00
x
dbb621fa9e fix txs_verification unit test 2023-11-19 19:54:12 +01:00
x
89da561315 fix genesis_mint unit test 2023-11-19 18:21:03 +01:00
parazyd
6933f333cc rpc/server: Implement stop-gap hack for handling some XMRig requests. 2023-11-19 16:17:50 +01:00
x
ca2ebcf9fa mint-pay-swap: fix broken unit test 2023-11-19 15:57:03 +01:00
x
fd934a8e3a introduce CoinParams to money_xfer 2023-11-19 08:38:51 +01:00
x
7598243783 split money client transfer_v1.rs into submodules: make_transfer_call(), builder and proofs. 2023-11-18 15:43:21 +01:00
x
929b6d0833 improve transfer_v1, simplify the default builder, and provide a lower level API for constructing more complex calls 2023-11-18 14:48:15 +01:00
y
117b4c6750 [eventgraph/util] formatting 2023-11-17 15:55:23 -05:00
y
d8e957788b [net] Fix issue Dag prune issue
There was an error in calculating the timestamp for the next "rotation",
i.e. when the Dag should prune.
This commit fixes:
- An underflow when calculating the sleep time for the Dag pruning
  process
- An off-by-one error that caused next_rotation_timestamp to give a
  timestamp in the past

Unit tests have also been added to prevent the above problems from
occurring again. They should be general enough to catch rotation periods
that are more complex than a period of `1`, which is what we are
currently using
2023-11-17 14:55:53 -05:00
y
bf5d77c31f [net] Modify Event pruning debugging
Change approach to dynamically calculate Genesis rather than storing it
in the EventGraph struct.

Add error-level debug messages in the case when a peer requests an
outdated Event and the node responds without an error. This indicates
that our Dag contains outdated events, indicating that the previous
prune failed.
2023-11-17 11:27:44 -05:00
y
c7727c8633 [net] Add debug messages when receiving old Events
Added debug statements when an EventPut occurs for an event with
a timestamp that is older than the Genesis event of the EventGraph.

Ideally this shouldn't happen but could theoretically occur if a node
does not properly prune its DAG.

In order to do this, `genesis` and `days_rotation` were added as fields
to EventGraph and 'getter' methods were added to retrieve these values.
2023-11-17 10:19:00 -05:00
x
b855d33d9f money_transfer: split coin selection into a separate function 2023-11-17 11:52:17 +01:00
y
521bc801fa [net] tor-dialer: revert to panic and document why 2023-11-16 15:59:57 -05:00
y
e4eb6754dd [net] Tor dialers: return error instead of panic
Refactor the Tor Dialers to return an error instead of panicking via
unwrap(). In any case, we don't expect this to happen because new
dialers are instantiated using a macro that ensures that endpoints have
valid hosts and ports.
2023-11-16 13:42:21 -05:00
parazyd
915520ea99 eventgraph: Use atomic database operations.
Additionally this changes the dag_insert API to take a slice of events.
2023-11-16 15:25:38 +01:00