Commit Graph

149 Commits

Author SHA1 Message Date
parazyd
5aad1deb73 runtime/import/merkle: Account for gas costs in merkle_add() 2024-01-19 11:17:44 +01:00
parazyd
a3ed654d3a runtime/import/db: Apply gas subtraction to remaining db.rs functions 2024-01-18 13:23:08 +01:00
parazyd
9fb2febfb3 runtime/import/db: Implement host gas cost for zkas_db_set()
This is unfinished, as we should properly account for the ZkBinary
rather than just charging a fixed cost for every literal/witness/opcode.
2024-01-18 12:50:30 +01:00
parazyd
c03d48645c runtime/import: Subtract gas fee in get_slot() 2024-01-17 15:46:29 +01:00
parazyd
f9515f3ddc runtime: Begin implementation of host function gas costs 2024-01-17 15:38:12 +01:00
aggstam
e829424a9c sdk/util: added block height retrieval functions and use them at appropriate places 2024-01-16 18:07:39 +02:00
parazyd
e340fa6824 sdk: Apply relevant changes related to 3240221614 2024-01-16 16:20:14 +01:00
parazyd
3240221614 runtime/import: General function cleanup and use darkfi_sdk error codes
The general idea is that functional stuff inside wasm ends at 32-bits
and anything above is considered an error as per darkfi_sdk::error.
2024-01-16 16:07:18 +01:00
parazyd
87a85e047f runtime/import: Enable pages assertion in put_object_bytes() 2024-01-16 14:18:25 +01:00
parazyd
e034470611 runtime: Minor comment cleanups and log verbosity. 2024-01-16 14:13:26 +01:00
parazyd
0e6f51e895 chore: Update copyright year in license headers 2024-01-16 13:07:22 +01:00
parazyd
561318cf6f runtime: Disable payload debug message on Deploy 2024-01-09 16:06:40 +01:00
parazyd
e102f84e56 runtime: Remove unused sanity_check() function
This is now done inside the deployooor contract.
2024-01-09 12:09:34 +01:00
zero
cc2de1aca1 spec2: concepts page 2024-01-04 10:06:59 +01:00
parazyd
001bdecb53 runtime: Remove unused acl_deny function 2023-12-26 13:31:37 +01:00
x
c3587c0c6f general cleanup, clippy & update VKS/PKS in test-harness 2023-12-23 13:33:00 +01:00
ertosns
c83ad39e2b [runtime/vm_runtime] comment copy_to_memory 2023-12-22 16:33:47 +02:00
ertosns
27f123da5a [runtime/import/merkle] replace assertion by returning an error 2023-12-22 15:41:18 +02:00
ertosns
a4666d2549 [runtime/import/merkle] check if buffer is fully read 2023-12-22 15:38:31 +02:00
ertosns
7240222b21 [runtime/memory] test write_slice 2023-12-22 15:37:16 +02:00
parazyd
0231beba7f validator: Add placeholder for tx fee enforcement 2023-12-19 17:26:26 +01:00
parazyd
b48b58af03 chore: Clippy lints 2023-12-13 10:20:38 +01:00
y
dbba9ac939 runtime: Use deserialize instead of Cursor
Modify the zkas_db_set function to use deserialize instead of Cursor.
This provides stronger validation on the data passed to the function
2023-12-07 12:20:16 -05:00
y
753d01b249 runtime/sdk: change return types from i32 to i64 2023-12-07 11:57:08 -05:00
y
facbc1fc38 runtime: cleanup db_contains_key, zkas_db_set 2023-12-07 10:39:38 -05:00
y
e02fd444cd runtime: Cleanup db_get() and db_del() 2023-12-06 14:06:01 -05:00
y
ae9a904c3d runtime: db_set cleanup
Also fix some typos in db_lookup
2023-12-06 11:40:00 -05:00
y
126915ce53 runtime: Resolve Cursor TODO in db_lookup
Also refactor the param `len` to `ptr_len` to be consistent with db_init
2023-12-06 10:54:49 -05:00
y
0d0f4e861d runtime: cleanup db_lookup
- Add comments to make operations more clear
- Change logging structure to be more detailed
- Resolve TODO concerning duplicated DbHandles
2023-12-05 15:23:47 -05:00
parazyd
0fc67d63b6 runtime: Clean up db/db_init() 2023-12-01 15:05:32 +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
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
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
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
parazyd
8f46f7b777 lib: Clean up library features. 2023-08-29 13:08:35 +02:00
parazyd
60595e3002 zk: Handle invalid witnesses gracefully in empty_witnesses(). 2023-07-22 15:42:45 +02:00
parazyd
8ac1d17077 Use k param from ZkBinary when building VerifyingKey and ProvingKey. 2023-07-22 12:04:41 +02:00
parazyd
29101c4e02 zk: Pass a ZkBinary reference to ZkCircuit::new instead of cloning. 2023-07-20 14:19:52 +02:00
aggstam
0d00179abd darkfid2: further extend tests foundation | repo: fmt 2023-07-03 16:50:44 +03:00
aggstam
6fa4049a1b Make Repo Great Again 2023-06-29 17:29:23 +03:00
aggstam
feabf5a67a blockchain: rewrite completed
Attention: this commit breaks darkfid/faucetd network functionalities, so nodes can't sync or participate in the protocol. Wait for their rewrite(TM)
2023-06-28 14:42:14 +03:00
aggstam
ec97e969c8 sdk: renamed SlotCheckpoint to Slot 2023-06-24 18:18:08 +03:00