add ziren guest program

Co-authored-by: weilzkm <140377101+weilzkm@users.noreply.github.com>
This commit is contained in:
Guillaume Ballet 2025-09-09 14:25:43 -04:00 committed by Felix Lange
parent f390d79b6b
commit b871219572
6 changed files with 54 additions and 2 deletions

View file

@ -30,8 +30,10 @@ import (
"github.com/ethereum/go-ethereum/rlp"
)
// This is taken from PR #32216 until it's merged
// ExtWitness is a witness RLP encoding for transferring across clients.
// This is taken from PR #32216 until it's merged.
// It contains block headers, contract codes, state nodes, and storage keys
// required for stateless execution verification.
type ExtWitness struct {
Headers []*types.Header `json:"headers"`
Codes []hexutil.Bytes `json:"codes"`

View file

@ -0,0 +1,37 @@
// Copyright 2025 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//go:build ziren
package main
import (
zkruntime "github.com/zkMIPS/zkMIPS/crates/go-runtime/zkm_runtime"
"github.com/ethereum/go-ethereum/params"
)
func getChainConfig() *params.ChainConfig {
return params.MainnetChainConfig
}
// getInput reads the input payload from the zkVM runtime environment.
// The zkVM host provides the RLP-encoded Payload structure containing
// the block and witness data through the runtime's input mechanism.
func getInput() []byte {
// Read the RLP-encoded payload directly from the zkVM runtime
input := zkruntime.Read[[]byte]()
return input
}

View file

@ -27,6 +27,8 @@ import (
"github.com/ethereum/go-ethereum/rlp"
)
// Payload represents the input data for stateless execution containing
// a block and its associated witness data for verification.
type Payload struct {
Block *types.Block
Witness *stateless.Witness

View file

@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//go:build !example
//go:build !example && !ziren
package main

7
go.mod
View file

@ -77,10 +77,17 @@ require (
gopkg.in/yaml.v3 v3.0.1
)
replace (
github.com/zkMIPS/zkMIPS => github.com/weilzkm/zkMIPS v0.0.0-20250909003003-28d77c6da0a4
github.com/zkMIPS/zkMIPS/crates/go-runtime/zkm_runtime => github.com/weilzkm/zkMIPS/crates/go-runtime/zkm_runtime v0.0.0-20250909003003-28d77c6da0a4
)
require (
github.com/zkMIPS/zkMIPS/crates/go-runtime/zkm_runtime v0.0.0-00010101000000-000000000000
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/DataDog/zstd v1.4.5 // indirect
github.com/ProjectZKM/Ziren v1.1.5-0.20250905082253-b08c6f04754a // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 // indirect

4
go.sum
View file

@ -14,6 +14,8 @@ github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/ProjectZKM/Ziren v1.1.5-0.20250905082253-b08c6f04754a h1:CcAopGCk/nDibTW/xjbF9x857n/5nVwIS3gTrNoqSLE=
github.com/ProjectZKM/Ziren v1.1.5-0.20250905082253-b08c6f04754a/go.mod h1:rtDqI3yXT1S+xow+/3VxJVht8DRSO8XFfRn6vEqRYYE=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI=
@ -362,6 +364,8 @@ github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/weilzkm/zkMIPS/crates/go-runtime/zkm_runtime v0.0.0-20250909003003-28d77c6da0a4 h1:lcn3LrFmGY6eu4+BrzKkfnN2MoLShmgCEYf+nKE+bOU=
github.com/weilzkm/zkMIPS/crates/go-runtime/zkm_runtime v0.0.0-20250909003003-28d77c6da0a4/go.mod h1:zk/SUgiiVz2U1ufZ+yM2MHPbD93W25KH5zK3qAxXbT4=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=