99 Commits

Author SHA1 Message Date
Robin Salen
385ab3c64f
Remove redundant 2023-10-23 08:15:10 -04:00
Robin Salen
d185d30e89
Speed-up memset and fix it to write 0 values 2023-10-23 07:55:09 -04:00
Robin Salen
4140eb54f4
Fix 2023-10-23 07:20:52 -04:00
Robin Salen
503a31b6f0
Reviews 2023-10-23 07:16:39 -04:00
Robin Salen
ba61d15cf9
Add macro for copying sequences of bytes 2023-10-21 16:36:41 -04:00
Hamy Ratoanina
49ca63ee0f
Fix sys_blockhash (#1285) 2023-10-11 10:23:09 -04:00
wborgeaud
8c78271f5c
Add random value to block metadata and fix sys_prevrandao (#1207)
* Add random to block metadata and fix `sys_prevrandao`

* Minor

* Observe block_random

* Write block_random

* cargo fmt

* block_random: H256

* Move sys_prevrandao to metadata.asm and delete syscall_stubs.asm

* Set block_random in set_block_metadata_target

* Minor

* Minor
2023-09-25 18:20:22 +02:00
Robin Salen
053553d4d7
Reuse new packing instructions for MLOAD and MSTORE 2023-09-18 16:31:46 -04:00
Robin Salen
7ebbb47fcd
Swap ordering in stack macro (#1230)
* Swap ordering in stack macro

* Update comment
2023-09-13 08:39:01 -04:00
Robin Salen
9508b49090
Move byte packing / unpacking to a distinct table (#1212)
* Duplicate Memory trace into BytePacking one

* Add mload_32bytes instruction

* Use dedicated ops for byte packing trace

* Change witness generation to reduce memory reads for MLOAD_32BYTES

* Remove segments

* Fix stack

* Fix extra product when fixing CTL for byte_packing

* Write output value in trace

* Add constraints for BYTE_PACKING table

* Add recursive constraints for BYTE_PACKING table

* Fix constraints

* Add address in trace and constraints

* Add timestamp and batch inputs into BytePackingOp struct

* Add extra column

* Fix BytePackingStark CTL

* Tiny fix in witness generation

* Fix the Memory CTL

* Add constraints for the new columns

* Remove 1 column

* Remove limb columns

* Fix

* Fix recursive circuit of BytePackingTable

* Fix constraints

* Fix endianness

* Add MSTORE_32BYTES instruction and move decomposition to packing table

* Add missing constraint

* Add range-check for all bytes

* Add extra constraint

* Cleanup

* Remove REMAINING_LEN column

* Add corresponding implementations in interpreter

* Fix recursive version

* Remove debug assertion because of CI

* Remove FILTER column

* Update new test from rebasing

* Reorder STARK modules to match TraceCheckPoint ordering

* Address comments

* Pacify clippy

* Add documentation to the packing module

* Fix doctest
2023-09-13 04:45:37 +10:00
Linda Guiga
1c01d682aa
Fix overflow check and test. Remove [..8] when using h256_limbs. 2023-09-07 09:44:00 +01:00
Linda Guiga
4e0fe74a74
Apply comments 2023-09-07 09:43:59 +01:00
Linda Guiga
42f7038031
Add blockhash sys opcode 2023-09-07 09:43:59 +01:00
wborgeaud
c8ff80caa2 Fix blake2 fix 2023-06-16 09:23:53 +02:00
Nicholas Ward
246eb8d80c blake fix 2023-06-15 21:51:09 -07:00
wborgeaud
68b15ea503
Fix CALLDATALOAD for large offsets (#1085) 2023-06-08 12:08:02 +02:00
wborgeaud
0f7e1c0b61
Call stack depth (#1081) 2023-06-07 18:54:06 +02:00
wborgeaud
973624f12d
Minor fixes to RETURN and RETURNDATACOPY (#1060) 2023-06-02 19:58:04 +02:00
wborgeaud
84c156066b
Minor fixes to returndata and create (#1043)
* Fix returndata

* Add AccountCreated event

* returndatacopy_afterFailing_create.json passes

* Fix
2023-05-17 10:06:12 +02:00
Nicholas Ward
6ebee38e72 fix 2023-05-15 11:02:21 -07:00
Nicholas Ward
76fb31606a Merge branch 'memory-refactor' into precompile-memory-context-change 2023-05-10 09:55:59 -07:00
Nicholas Ward
0d9e321647 fix (mstore_unpacking returns offset) 2023-05-10 09:55:35 -07:00
Nicholas Ward
97aedd11cf Merge branch 'memory-refactor' into precompile-memory-context-change 2023-05-10 09:22:04 -07:00
Nicholas Ward
6e7fa6da02 fix 2023-05-10 09:21:52 -07:00
Nicholas Ward
57bcb45104 use mstore_unpacking and mload_packing 2023-05-10 09:12:30 -07:00
Nicholas Ward
6669f73abe use mstore_unpacking and mload_packing 2023-05-10 09:09:21 -07:00
Nicholas Ward
af12368a7b addressed comments & cleanup 2023-05-10 08:48:05 -07:00
Nicholas Ward
98a75774d4 cleanup 2023-05-10 08:39:35 -07:00
Nicholas Ward
a4a4fbb39b fmt 2023-05-09 10:57:59 -07:00
Nicholas Ward
057b650fc2 fix 2023-05-08 16:35:58 -07:00
Nicholas Ward
24159886eb precompile memory context change 2023-05-08 16:23:14 -07:00
Nicholas Ward
d9694d95a6 fix 2023-05-08 16:22:12 -07:00
Nicholas Ward
446c3b7140 fix 2023-05-08 16:02:43 -07:00
Nicholas Ward
b566dbd735 refactor memory/core.asm to make code more reusable 2023-05-08 15:52:35 -07:00
Daniel Lubarov
b159c9e791
Merge pull request #1013 from topos-network/overflow-check
Address overflow-related TODOs in ASM code.
2023-05-02 10:22:53 -07:00
Robin Salen
17a7c57d03
Change add_or_fault macro 2023-05-02 08:22:00 +02:00
Linda Guiga
1f39c555a9
Address overflow-related TODOs in ASM code, using a macro add_or_fault. This is related to a4ea0965d7 2023-05-02 08:22:00 +02:00
Nicholas Ward
031fe6ed90 Merge branch 'main' into expmod_precompile 2023-04-28 11:39:47 -07:00
Nicholas Ward
badbf01021 store and unpack at end 2023-04-28 11:01:51 -07:00
Nicholas Ward
dc91554da2 expmod precompile 2023-04-25 17:19:44 -07:00
Nicholas Ward
454e0add24 fixed blake2_f, and testing 2023-04-24 16:58:57 -07:00
Nicholas Ward
1eba893e61 mload_packing macro 2023-04-24 11:25:38 -07:00
wborgeaud
6edd589138
Gas and more for CREATE(2) (#995)
* Gas

* Codehash

* Minor
2023-04-20 07:00:15 +02:00
Daniel Lubarov
58f4568e7c
Merge pull request #982 from toposware/sys_chainid
Use Block chain id for sys_chainid
2023-04-12 14:43:43 -07:00
Hamy Ratoanina
92d94dc60d
Use Block chain id for sys_chainid 2023-04-12 15:25:06 -04:00
wborgeaud
c7e60073f0
Check if context is static for state-changing opcodes (#973)
* Check if context is static for state-changing opcodes

* PR feedback
2023-04-12 08:24:33 +02:00
wborgeaud
af3fa1426e
Implement sys_return and sys_revert (#959)
* Fix gas and copy returndata in sys_return

* Also revert

* mstore_parent_context_metadata macros
2023-04-06 07:22:16 +02:00
wborgeaud
923722b1e4
Fix copy opcodes when offset is large (#957)
* Fix wcopy

* Fix extcodecopy and use memset

* Comments
2023-04-05 06:24:26 +02:00
wborgeaud
6fa59d204f
Fix MSTORE8 (#955)
* Fix MSTORE8

* Small optimization
2023-04-03 16:39:18 +02:00
wborgeaud
a0d04ca3d8
Fix Wcopy when size=0 (#944) 2023-03-29 19:58:44 +02:00