-
Notifications
You must be signed in to change notification settings - Fork 667
feat: Refactor stateless executor #10629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
rubo
wants to merge
112
commits into
master
Choose a base branch
from
feature/stateless-zisk
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,820
−1,430
Draft
Changes from 2 commits
Commits
Show all changes
112 commits
Select commit
Hold shift + click to select a range
2d86ee6
Add initial refactored stateless executor
rubo fcfd95c
Fix a typo
rubo e760d5d
Make paths absolute
rubo 5a07052
Add `modexp` precompile
rubo d6c4906
Add `BLS12_PAIRING_CHECK` precompile
rubo ba1dd7d
Add `BLS12_G2ADD` precompile
rubo b7d02cb
Add `BLS12_G2MSM` precompile
rubo cd466f7
Revise `Makefile`
rubo 143938d
Merge branch 'master' into feature/stateless-zisk
rubo 541baab
Add `BLS12_MAP_FP_TO_G1` precompile
rubo e2160c1
Add `BLS12_MAP_FP2_TO_G2` precompile
rubo 9753bad
Add `BLS12_G1ADD` precompile
rubo c34ad37
Add `BLS12_G1MSM` precompile
rubo d970109
Implement preliminary input serialization
rubo e835363
Merge branch 'master' into feature/stateless-zisk
rubo c101661
Revise input formatting
rubo 1ecab29
Refactor and add SecP256k1 functions
rubo cbaa939
Shut the cspell up
rubo bef6f51
Change chain id to `uint` and add tx sig recovery (disabled)
rubo e0dc870
Reformat
rubo 9265125
Refactor and optimize Zisk I/O
rubo 663c8fe
Minor refactor
rubo 2643987
Replace throwing errors with fail-fasts.
rubo dde4bbb
Simplify the entrypoint
rubo e1afdea
Switch to little-endian
rubo a56075f
Refactor Zisk I/O
rubo ce38d9c
Optimize RLP handling
rubo e7e7874
Add `KZG_POINT_EVALUATION` precompile function
rubo f51fe71
Add `P256VERIFY` precompile function
rubo e06917b
Add Keccak-256 function
rubo aadec1f
Add SHA-256 function
rubo 2670814
Revise execution result handling
rubo 7a3f4ec
Fix `secp256k1_ecdsa_address_recover_c` signature
rubo 72cc51c
Add `BLAKE2F` precompile function
rubo 04f051d
Revise serialization length handling
rubo 4b9fe52
Micro-optimize Zisk I/O
rubo caa49ee
Merge branch 'master' into feature/stateless-zisk
rubo 501c9a6
Replace `zkVM` with `zkEVM`
rubo 7dff8ea
Fix `Witness` API usage
rubo db5e9a1
Fix tester
rubo cda0ba4
Micro-optimize Zisk I/O
rubo 464b222
Make `StatelessExecutor` static
rubo 00df3f3
Merge branch 'master' into feature/stateless-zisk
rubo 650edc5
Improve tester
rubo fc35feb
Fix RLP API
rubo 7835da8
Add testing workflow
rubo 0395776
Remove redundant namespace
rubo 04a2412
Dispose decoded headers
rubo 5b77145
Tighten serialization validation
rubo c234805
Remove redundant stuff
rubo af0d749
Dispose witness
rubo 9f06eaa
Merge branch 'master' into feature/stateless-zisk
rubo 1235eef
Hardcode `nethermindeth/bflat-riscv64` image
rubo be19b0c
Use a NuGet package for Zisk bindings
rubo 8e06802
Remove keys from serialization
rubo 2c99f6d
Fix Zisk testing
rubo e162eb3
Merge branch 'master' into feature/stateless-zisk
rubo 04f0aa4
Remove `StatelessExecution` project
rubo 939ad50
Harden Zisk Dockerfile
rubo e0c6249
Switch to the latest `nethermindeth/bflat-riscv64`
rubo d50c8a3
Implement address recovery
rubo 8361a48
Fix formatting
rubo b6b234f
Add block validation
rubo 3f0cc6b
Merge branch 'master' into feature/stateless-zisk
rubo 16e6ea2
Cancel in-progress test
rubo 316dd42
Remove tx address null check
rubo f05898a
Refactor test workflow
rubo 6ea8960
Add dependencies to solution
rubo 53cd7e9
Reorder usings
rubo 832e48b
Merge branch 'master' into feature/stateless-zisk
rubo bf5af0b
Update Nethermind.ZiskBindings package
rubo d2e2bd2
Remove `Dockerfile.bflat`
rubo 5caee24
Use modern libziskos and implement canonical way to reference precomp…
maximmenshikov e73fc3b
Update `Nethermind.ZiskBindings` package
rubo acd2220
Implement `ECREC` precompile and refactor address recovery
rubo 1fcd952
Implement `BN254` precompiles
rubo 2d3ec98
Merge branch 'master' into feature/stateless-zisk
rubo 31f0a0f
Refactor `EthereumEcdsa` for zkEVM
rubo 320297d
Remove links to `Nethermind.Facade`
rubo a44a374
Improve conditional compilation handling
rubo 0feb4ab
Restore file name
rubo 2eab942
Merge branch 'master' into feature/stateless-zisk
rubo ad98c10
Implement `BLS12_G1ADD` precompile
rubo 8946c71
Switch to Zisk v0.16.0
rubo 37d7a94
Implement `BLS12_G1MSM` precompile
rubo 6a4a2c2
Unify function name
rubo a8c4fbb
Shut cspell up 🤮
rubo a9cf0a6
Merge branch 'master' into feature/stateless-zisk
rubo 10d8b05
Use `ulong` for chain id
rubo 5e99852
Refactor precompiles
rubo 2cab0ae
Merge branch 'master' into feature/stateless-zisk
rubo 9de75da
Revert `TransactionProcessor`
rubo bda1ba6
Implement `BLS12_G2ADD` precompile
rubo 2b6cc7f
Implement `BLS12_G2MSM` precompile
rubo a3c538b
Implement `BLS12_MAP_FP_TO_G1` precompile
rubo 6992f0f
Implement `BLS12_MAP_FP2_TO_G2` precompile
rubo 0461c5c
Update README
rubo c927e91
Merge branch 'master' into feature/stateless-zisk
rubo 060ae92
Implement `BLS12_PAIRING_CHECK` precompile
rubo a9bc3b1
Refactor EIP-2537 precompiles
rubo f30aed1
Merge branch 'master' into feature/stateless-zisk
rubo 6d95550
Update Nethermind.ZiskBindings package
rubo 0fc1fe3
Merge `Tester` project into `ZiskGuest`
rubo 4eee306
Move the project to be alongside the main codebase
rubo 2203263
Merge branch 'master' into feature/stateless-zisk
rubo f7d15b0
Restore `ECRecoverPrecompile` file name
rubo 58ddd96
Implement `MODEXP` precompile
rubo 2b76fb5
Merge branch 'master' into feature/stateless-zisk
rubo 006cb3a
Implement `KZG_POINT_EVALUATION` precompile
rubo a502c86
Bring back `KzgPolynomialCommitments.BlsModulus`
rubo c9a49b9
Implement `P256VERIFY` precompile
rubo 4ecf70c
Implement `SHA256` precompile
rubo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <AssemblyName>Nethermind.Stateless.Executor</AssemblyName> | ||
| <RootNamespace>Nethermind.Stateless.Execution</RootNamespace> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\..\src\Nethermind\Nethermind.Core\Nethermind.Core.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Nethermind\Nethermind.Facade\Nethermind.Facade.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Nethermind\Nethermind.Db\Nethermind.Db.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Nethermind\Nethermind.Trie\Nethermind.Trie.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Nethermind\Nethermind.Evm\Nethermind.Evm.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Nethermind\Nethermind.Specs\Nethermind.Specs.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Nethermind\Nethermind.Consensus\Nethermind.Consensus.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Nethermind\Nethermind.Logging.NLog\Nethermind.Logging.NLog.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Nethermind\Nethermind.Serialization.Rlp\Nethermind.Serialization.Rlp.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <Solution> | ||
| <Project Path="Executor/Executor.csproj" /> | ||
| <Project Path="ZiskGuest/ZiskGuest.csproj" /> | ||
| </Solution> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited | ||
| # SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| FROM nethermindeth/bflat-riscv64:latest | ||
|
|
||
| RUN apt-get update && apt-get install -y --no-install-recommends strace gdb file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited | ||
| # SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| FROM rust:latest | ||
|
|
||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| libomp-dev \ | ||
| libopenmpi-dev \ | ||
| libsodium-dev && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN curl -L https://raw.githubusercontent.com/0xPolygonHermez/zisk/main/ziskup/ziskup | bash -s -- --nokey | ||
|
|
||
| ENV PATH="/root/.zisk/bin:${PATH}" | ||
|
|
||
| WORKDIR /n | ||
|
|
||
| COPY bin/nethermind . | ||
|
|
||
| CMD ["tail", "-f", "/dev/null"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited | ||
| # SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| ARTIFACTS_DIR := $(abspath ../../artifacts/bin/ZiskGuest/release) | ||
| BIN_DIR := /nethermind/bin | ||
| SRC_DIR := /nethermind/src | ||
|
|
||
| BFLAT_BUILD := bflat build -x --verbose \ | ||
| --arch riscv64 \ | ||
| --os linux \ | ||
| --stdlib dotnet \ | ||
| --no-pthread \ | ||
| --no-pie \ | ||
| --nostdlibrefs \ | ||
| --no-stacktrace-data \ | ||
| --no-globalization | ||
| BFLAT_REFS := \ | ||
| -r {std}/Microsoft.Win32.Primitives.dll \ | ||
| -r {std}/netstandard.dll \ | ||
| -r {std}/System.Collections.dll \ | ||
| -r {std}/System.Collections.Concurrent.dll \ | ||
| -r {std}/System.Collections.Immutable.dll \ | ||
| -r {std}/System.ComponentModel.Primitives.dll \ | ||
| -r {std}/System.Console.dll \ | ||
| -r {std}/System.Diagnostics.DiagnosticSource.dll \ | ||
| -r {std}/System.Diagnostics.Process.dll \ | ||
| -r {std}/System.Diagnostics.StackTrace.dll \ | ||
| -r {std}/System.Diagnostics.Tracing.dll \ | ||
| -r {std}/System.IO.Pipes.dll \ | ||
| -r {std}/System.Linq.dll \ | ||
| -r {std}/System.Memory.dll \ | ||
| -r {std}/System.Net.Primitives.dll \ | ||
| -r {std}/System.Net.Sockets.dll \ | ||
| -r {std}/System.Reflection.Metadata.dll \ | ||
| -r {std}/System.Runtime.dll \ | ||
| -r {std}/System.Runtime.InteropServices.dll \ | ||
| -r {std}/System.Runtime.Intrinsics.dll \ | ||
| -r {std}/System.Runtime.Numerics.dll \ | ||
| -r {std}/System.Security.Cryptography.dll \ | ||
| -r {std}/System.Text.RegularExpressions.dll \ | ||
| -r {std}/System.Threading.dll \ | ||
| -r {std}/System.Threading.Tasks.Parallel.dll \ | ||
| -r {std}/System.Threading.Thread.dll \ | ||
| -r {std}/System.Threading.ThreadPool.dll \ | ||
| -r $(BIN_DIR)/Microsoft.Extensions.ObjectPool.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Abi.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Blockchain.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Consensus.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Core.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Crypto.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Db.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Evm.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Evm.Precompiles.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Facade.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Int256.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Logging.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Serialization.Rlp.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Specs.dll \ | ||
| -r $(BIN_DIR)/Nethermind.State.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Stateless.Executor.dll \ | ||
| -r $(BIN_DIR)/Nethermind.Trie.dll \ | ||
| -r $(BIN_DIR)/Nethermind.TxPool.dll \ | ||
| -r $(BIN_DIR)/BouncyCastle.Cryptography.dll \ | ||
| -r $(BIN_DIR)/NonBlocking.dll \ | ||
| -r $(BIN_DIR)/FastEnum.Core.dll | ||
| BFLAT_SRC := \ | ||
| $(SRC_DIR)/Program.cs \ | ||
| $(SRC_DIR)/Zisk.Memory.cs \ | ||
| $(SRC_DIR)/Zisk.Precompiles.cs | ||
|
|
||
| DOCKER_RUN := docker run --platform linux/amd64 --rm \ | ||
| -e DOTNET_TYPELOADER_TRACE_INTERFACE_RESOLUTION=0 \ | ||
| -w $(SRC_DIR) \ | ||
| --mount type=bind,source="$(ARTIFACTS_DIR)",target=$(BIN_DIR) \ | ||
| --mount type=bind,source="$(CURDIR)",target=$(SRC_DIR) \ | ||
| bflat-ricsv64-local | ||
|
|
||
| build-docker-bflat: | ||
| docker build --platform linux/amd64 -f Dockerfile.bflat -t bflat-ricsv64-local . | ||
|
|
||
| build-dotnet: | ||
| dotnet build -c release -p:EnableZkvm=true | ||
|
|
||
| build-zisk: build-docker-bflat | ||
| $(DOCKER_RUN) $(BFLAT_BUILD) --libc zisk $(BFLAT_REFS) $(BFLAT_SRC) \ | ||
| --extlib https://github.com/NethermindEth/bflat-libziskos:pre-develop-0.16.0 | ||
| mkdir -p bin; mv -f Program.patched bin/nethermind; rm -f Program Program.o | ||
|
|
||
| build-zisk-sim: build-docker-bflat | ||
| $(DOCKER_RUN) $(BFLAT_BUILD) --libc zisk_sim $(BFLAT_REFS) $(BFLAT_SRC) | ||
| mkdir -p bin; mv -f Program bin/nethermind; rm -f Program.o | ||
|
|
||
| run-zisk: build-zisk | ||
| docker build --platform linux/amd64 -f Dockerfile.zisk -t zisk . | ||
| docker run --rm -it -e RUST_BACKTRACE=full zisk ziskemu -e /n/nethermind | ||
|
|
||
| .PHONY: build-docker build-dotnet build-zisk build-zisk-sim run-zisk | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited | ||
| // SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| using Nethermind.Core.Crypto; | ||
| using Nethermind.Stateless.Execution; | ||
| using System.Buffers.Binary; | ||
|
|
||
| namespace Nethermind.Stateless.ZiskGuest; | ||
|
|
||
| class Program | ||
| { | ||
| static int Main() | ||
| { | ||
| // TODO: Replace with Zisk.ReadInput() and parse the input into the expected format for StatelessExecutor | ||
| Zisk.WriteLine("hella good"); | ||
|
Check warning on line 15 in tools/Stateless/ZiskGuest/Program.cs
|
||
|
|
||
| (int status, Hash256 hash) = StatelessExecutor.Execute(); | ||
|
|
||
| if (status == 0) | ||
| { | ||
| var size = sizeof(uint); | ||
|
|
||
| for (int i = 0, count = hash.Bytes.Length / size; i < count; i++) | ||
| { | ||
| var start = i * size; | ||
|
|
||
| Zisk.SetOutput(i, BinaryPrimitives.ReadUInt32BigEndian(hash.Bytes[start..(start + size)])); | ||
| } | ||
| } | ||
|
|
||
| return status; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Nethermind guest for Zisk | ||
|
|
||
| Building the guest app requires Linux and Docker. | ||
|
|
||
| ### Usage | ||
|
|
||
| To build an ELF binary for Zisk, run the following: | ||
|
|
||
| ```bash | ||
| make build-zisk | ||
| ``` | ||
|
|
||
| The resulting binary can be found in `bin/nethermind`. | ||
|
|
||
| To execute Nethermind guest in Zisk, run the following (invokes the previous step automatically): | ||
|
|
||
| ```bash | ||
| make run-zisk | ||
| ``` | ||
|
|
||
| For details, see the [Makefile](./Makefile). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| // SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited | ||
| // SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| using System.Runtime.CompilerServices; | ||
|
|
||
| namespace Nethermind.Stateless.ZiskGuest; | ||
|
|
||
| public static unsafe partial class Zisk | ||
| { | ||
| private const ulong INPUT_ADDR = 0x90000000UL; | ||
| private const ulong OUTPUT_ADDR = 0xa0010000UL; | ||
| private const ulong UART_ADDR = 0xa0000200UL; | ||
|
|
||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static byte[] ReadInput() | ||
| { | ||
| byte* sizePtr = (byte*)(INPUT_ADDR + 8); | ||
| ulong size = 0; | ||
|
|
||
| for (int i = 0; i < 8; i++) | ||
| size |= ((ulong)sizePtr[i]) << (i * 8); | ||
|
|
||
| if (size == 0) return []; | ||
|
|
||
| byte[] result = new byte[size]; | ||
| byte* dataPtr = (byte*)(INPUT_ADDR + 16); | ||
|
|
||
| for (ulong i = 0; i < size; i++) | ||
| result[i] = dataPtr[i]; | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static void SetOutput(int id, uint value) | ||
| { | ||
| if (id < 0 || id >= 64) return; | ||
|
|
||
| uint* baseAddr = (uint*)OUTPUT_ADDR; | ||
| uint currentCount = *baseAddr; | ||
|
|
||
| if (id + 1 > currentCount) | ||
| *baseAddr = (uint)(id + 1); | ||
|
|
||
| *(baseAddr + 1 + id) = value; | ||
| } | ||
|
|
||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static void WriteChar(char c) | ||
| { | ||
| *(byte*)UART_ADDR = (byte)c; | ||
| } | ||
|
|
||
| public static void WriteString(string s) | ||
| { | ||
| for (int i = 0; i < s.Length; i++) | ||
| WriteChar(s[i]); | ||
| } | ||
|
|
||
| public static void WriteLine(string s) | ||
| { | ||
| WriteString(s); | ||
| WriteChar('\n'); | ||
| } | ||
|
|
||
| /// Read 64-bit unsigned integer from byte array (little-endian) | ||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static ulong ReadUInt64(byte[] data, int offset = 0) | ||
| { | ||
| if (data.Length < offset + 8) return 0; | ||
|
|
||
| ulong result = 0; | ||
| for (int i = 0; i < 8; i++) | ||
| result |= ((ulong)data[offset + i]) << (i * 8); | ||
| return result; | ||
| } | ||
|
|
||
| /// Read 32-bit unsigned integer from byte array (little-endian) | ||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static uint ReadUInt32(byte[] data, int offset = 0) | ||
| { | ||
| if (data.Length < offset + 4) return 0; | ||
|
|
||
| uint result = 0; | ||
| for (int i = 0; i < 4; i++) | ||
| result |= ((uint)data[offset + i]) << (i * 8); | ||
| return result; | ||
| } | ||
|
|
||
| /// Output 64-bit value as two 32-bit outputs | ||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static void SetOutput64(int baseId, ulong value) | ||
| { | ||
| SetOutput(baseId, (uint)(value & 0xFFFFFFFF)); | ||
| SetOutput(baseId + 1, (uint)(value >> 32)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited | ||
| // SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| #pragma warning disable CA1401 // P/Invokes should not be visible | ||
| #pragma warning disable SYSLIB1054 // Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time | ||
|
|
||
| using System.Runtime.InteropServices; | ||
|
|
||
| namespace Nethermind.Stateless.ZiskGuest; | ||
|
|
||
| public static unsafe partial class Zisk | ||
| { | ||
| public static class Precompiles | ||
| { | ||
| [DllImport("__Internal")] | ||
| public static extern byte bn254_g1_add_c(byte* p1, byte* p2, byte* ret); | ||
|
|
||
| [DllImport("__Internal")] | ||
| public static extern byte bn254_g1_mul_c(byte* point, byte* scalar, byte* ret); | ||
|
|
||
| [DllImport("__Internal")] | ||
| public static extern byte bn254_pairing_check_c(byte* pairs, nuint num_points); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <RootNamespace>Nethermind.Stateless.ZiskGuest</RootNamespace> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\Executor\Executor.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.