From a28c3cafae7fa752fcb18dc39dfc14c572999083 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Mon, 28 Oct 2024 21:54:02 -0700 Subject: [PATCH 01/43] feat: evm client implementation --- execution.go | 220 ++++++++++++++++++++ go.mod | 108 +++++++++- go.sum | 565 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 891 insertions(+), 2 deletions(-) create mode 100644 execution.go create mode 100644 go.sum diff --git a/execution.go b/execution.go new file mode 100644 index 0000000..568b791 --- /dev/null +++ b/execution.go @@ -0,0 +1,220 @@ +package execution + +import ( + "context" + "errors" + "fmt" + "math/big" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rpc" + execution "github.com/rollkit/go-execution" + rollkitTypes "github.com/rollkit/rollkit/types" +) + +// Define necessary types and constants +type PayloadStatus string + +const ( + PayloadStatusValid PayloadStatus = "VALID" + PayloadStatusInvalid PayloadStatus = "INVALID" + PayloadStatusSyncing PayloadStatus = "SYNCING" +) + +var ( + ErrNilPayloadStatus = errors.New("nil payload status") + ErrInvalidPayloadStatus = errors.New("invalid payload status") +) + +type EngineAPIExecutionClient struct { + ethClient *ethclient.Client + engineClient *rpc.Client + genesisHash common.Hash + feeRecipient common.Address +} + +// NewEngineAPIExecutionClient creates a new instance of EngineAPIExecutionClient. +func NewEngineAPIExecutionClient(ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { + ethClient, err := ethclient.Dial(ethURL) + if err != nil { + return nil, fmt.Errorf("failed to connect to Ethereum client: %w", err) + } + engineClient, err := rpc.Dial(engineURL) + if err != nil { + return nil, fmt.Errorf("failed to connect to Engine API: %w", err) + } + return &EngineAPIExecutionClient{ + ethClient: ethClient, + engineClient: engineClient, + genesisHash: genesisHash, + feeRecipient: feeRecipient, + }, nil +} + +var _ execution.Execute = (*EngineAPIExecutionClient)(nil) + +// InitChain initializes the blockchain with genesis information. +func (c *EngineAPIExecutionClient) InitChain( + genesisTime time.Time, + initialHeight uint64, + chainID string, +) (rollkitTypes.Hash, uint64, error) { + ctx := context.Background() + var forkchoiceResult map[string]interface{} + err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + map[string]interface{}{ + "headBlockHash": c.genesisHash, + "safeBlockHash": c.genesisHash, + "finalizedBlockHash": c.genesisHash, + }, + map[string]interface{}{ + "timestamp": genesisTime.Unix(), + "prevRandao": common.Hash{}, // TO-DO + "suggestedFeeRecipient": c.feeRecipient, + }, + ) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + } + payloadID, ok := forkchoiceResult["payloadId"].(string) + if !ok { + return rollkitTypes.Hash{}, 0, ErrNilPayloadStatus + } + var payload map[string]interface{} + err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + } + stateRoot := common.HexToHash(payload["stateRoot"].(string)) + gasLimit := uint64(payload["gasLimit"].(float64)) + var rollkitStateRoot rollkitTypes.Hash + copy(rollkitStateRoot[:], stateRoot[:]) + return rollkitStateRoot, gasLimit, nil +} + +// GetTxs retrieves transactions from the transaction pool. +func (c *EngineAPIExecutionClient) GetTxs() ([]rollkitTypes.Tx, error) { + ctx := context.Background() + var result struct { + Pending map[string]map[string]*types.Transaction `json:"pending"` + Queued map[string]map[string]*types.Transaction `json:"queued"` + } + err := c.ethClient.Client().CallContext(ctx, &result, "txpool_content") + if err != nil { + return nil, fmt.Errorf("failed to get tx pool content: %w", err) + } + var txs []rollkitTypes.Tx + for _, accountTxs := range result.Pending { + for _, tx := range accountTxs { + txBytes, err := tx.MarshalBinary() + if err != nil { + return nil, fmt.Errorf("failed to marshal transaction: %w", err) + } + txs = append(txs, rollkitTypes.Tx(txBytes)) + } + } + for _, accountTxs := range result.Queued { + for _, tx := range accountTxs { + txBytes, err := tx.MarshalBinary() + if err != nil { + return nil, fmt.Errorf("failed to marshal transaction: %w", err) + } + txs = append(txs, rollkitTypes.Tx(txBytes)) + } + } + return txs, nil +} + +// ExecuteTxs executes the given transactions and returns the new state root and gas used. +func (c *EngineAPIExecutionClient) ExecuteTxs( + txs []rollkitTypes.Tx, + blockHeight uint64, + timestamp time.Time, + prevStateRoot rollkitTypes.Hash, +) (rollkitTypes.Hash, uint64, error) { + ctx := context.Background() + ethTxs := make([][]byte, len(txs)) + for i, tx := range txs { + ethTxs[i] = tx + } + prevRandao := c.derivePrevRandao(blockHeight) + var forkchoiceResult map[string]interface{} + err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + map[string]interface{}{ + "headBlockHash": common.BytesToHash(prevStateRoot[:]), + "safeBlockHash": common.BytesToHash(prevStateRoot[:]), + "finalizedBlockHash": common.BytesToHash(prevStateRoot[:]), + }, + map[string]interface{}{ + "timestamp": timestamp.Unix(), + "prevRandao": prevRandao, + "suggestedFeeRecipient": c.feeRecipient, + }, + ) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + } + payloadID, ok := forkchoiceResult["payloadId"].(string) + if !ok { + return rollkitTypes.Hash{}, 0, ErrNilPayloadStatus + } + var payload map[string]interface{} + err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + } + payload["transactions"] = ethTxs + var newPayloadResult map[string]interface{} + err = c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", payload) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) + } + status, ok := newPayloadResult["status"].(string) + if !ok || PayloadStatus(status) != PayloadStatusValid { + return rollkitTypes.Hash{}, 0, ErrInvalidPayloadStatus + } + newStateRoot := common.HexToHash(payload["stateRoot"].(string)) + gasUsed := uint64(payload["gasUsed"].(float64)) + var rollkitNewStateRoot rollkitTypes.Hash + copy(rollkitNewStateRoot[:], newStateRoot[:]) + return rollkitNewStateRoot, gasUsed, nil +} + +// SetFinal marks a block at the given height as final. +func (c *EngineAPIExecutionClient) SetFinal(blockHeight uint64) error { + ctx := context.Background() + block, err := c.ethClient.BlockByNumber(ctx, big.NewInt(int64(blockHeight))) + if err != nil { + return fmt.Errorf("failed to get block at height %d: %w", blockHeight, err) + } + var result map[string]interface{} + err = c.engineClient.CallContext(ctx, &result, "engine_forkchoiceUpdatedV1", + map[string]interface{}{ + "headBlockHash": block.Hash(), + "safeBlockHash": block.Hash(), + "finalizedBlockHash": block.Hash(), + }, + nil, // No payload attributes for finalization + ) + if err != nil { + return fmt.Errorf("engine_forkchoiceUpdatedV1 failed for finalization: %w", err) + } + payloadStatus, ok := result["payloadStatus"].(map[string]interface{}) + if !ok { + return ErrNilPayloadStatus + } + status, ok := payloadStatus["status"].(string) + if !ok || PayloadStatus(status) != PayloadStatusValid { + return ErrInvalidPayloadStatus + } + return nil +} + +// derivePrevRandao generates a deterministic prevRandao value based on block height. +func (c *EngineAPIExecutionClient) derivePrevRandao(blockHeight uint64) common.Hash { + // TO-DO + return common.BigToHash(big.NewInt(int64(blockHeight))) +} diff --git a/go.mod b/go.mod index 77d492d..8a47f38 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,107 @@ -module github.com/rollkit/template-da-repo +module github.com/rollkit/go-execution-evm -go 1.21.0 +go 1.22.8 + +replace github.com/rollkit/go-execution => github.com/lastdotnet/go-execution v0.0.0-20241029045146-b7513b533b24 + +require ( + github.com/ethereum/go-ethereum v1.14.11 + github.com/rollkit/go-execution v0.0.0-00010101000000-000000000000 + github.com/rollkit/rollkit v0.13.7 +) + +require ( + github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/StackExchange/wmi v1.2.1 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bits-and-blooms/bitset v1.13.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/celestiaorg/go-header v0.6.2 // indirect + github.com/cespare/xxhash v1.1.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cometbft/cometbft v0.38.7 // indirect + github.com/cometbft/cometbft-db v0.8.0 // indirect + github.com/consensys/bavard v0.1.13 // indirect + github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect + github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/deckarep/golang-set/v2 v2.6.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect + github.com/dgraph-io/badger/v2 v2.2007.4 // indirect + github.com/dgraph-io/ristretto v0.1.1 // indirect + github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/ethereum/c-kzg-4844 v1.0.0 // indirect + github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect + github.com/go-kit/kit v0.13.0 // indirect + github.com/go-kit/log v0.2.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/glog v1.2.1 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect + github.com/google/btree v1.1.2 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/gorilla/websocket v1.5.3 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/holiman/uint256 v1.3.1 // indirect + github.com/ipfs/go-cid v0.4.1 // indirect + github.com/ipfs/go-log/v2 v2.5.1 // indirect + github.com/jmhodges/levigo v1.0.0 // indirect + github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/libp2p/go-libp2p v0.35.0 // indirect + github.com/libp2p/go-libp2p-pubsub v0.11.0 // indirect + github.com/libp2p/go-msgio v0.3.0 // indirect + github.com/linxGnu/grocksdb v1.7.16 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/multiformats/go-base32 v0.1.0 // indirect + github.com/multiformats/go-base36 v0.2.0 // indirect + github.com/multiformats/go-multiaddr v0.13.0 // indirect + github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect + github.com/multiformats/go-multibase v0.2.0 // indirect + github.com/multiformats/go-multicodec v0.9.0 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-multistream v0.5.0 // indirect + github.com/multiformats/go-varint v0.0.7 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.30.0 // indirect + github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.48.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/stretchr/testify v1.9.0 // indirect + github.com/supranational/blst v0.3.13 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + go.etcd.io/bbolt v1.3.7 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/crypto v0.25.0 // indirect + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect + golang.org/x/net v0.27.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/text v0.16.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect + google.golang.org/grpc v1.65.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + lukechampine.com/blake3 v1.2.1 // indirect + rsc.io/tmplfunc v0.0.3 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..6eaf682 --- /dev/null +++ b/go.sum @@ -0,0 +1,565 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +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/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +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= +github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= +github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= +github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= +github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/celestiaorg/go-header v0.6.2 h1:qgWyJQg+/x6k4QAfN1rPt2HXHZjQOmCqD0ct4dFBIZY= +github.com/celestiaorg/go-header v0.6.2/go.mod h1:Az4S4NxMOJ1eAzOaF8u5AZt5UzsSzg92uqpdXS3yOZE= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/cometbft/cometbft v0.38.7 h1:ULhIOJ9+LgSy6nLekhq9ae3juX3NnQUMMPyVdhZV6Hk= +github.com/cometbft/cometbft v0.38.7/go.mod h1:HIyf811dFMI73IE0F7RrnY/Fr+d1+HuJAgtkEpQjCMY= +github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= +github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= +github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= +github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= +github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= +github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= +github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= +github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= +github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= +github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= +github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= +github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= +github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= +github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= +github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/go-ethereum v1.14.11 h1:8nFDCUUE67rPc6AKxFj7JKaOa2W/W1Rse3oS6LvvxEY= +github.com/ethereum/go-ethereum v1.14.11/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= +github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A= +github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= +github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= +github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= +github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= +github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= +github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= +github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= +github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 h1:E/LAvt58di64hlYjx7AsNS6C/ysHWYo+2qPCZKTQhRo= +github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= +github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= +github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= +github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= +github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= +github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= +github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= +github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= +github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/lastdotnet/go-execution v0.0.0-20241029045146-b7513b533b24 h1:F/XQxFKbZA1w8daNqHdh/8waKQfWLAyZTmkQVVxlgVk= +github.com/lastdotnet/go-execution v0.0.0-20241029045146-b7513b533b24/go.mod h1:fo+uH57fdmebAEYEVtLhsSJ7Jw8CKRSydCnyqJZRBAA= +github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= +github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= +github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= +github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= +github.com/libp2p/go-libp2p v0.35.0 h1:1xS1Bkr9X7GtdvV6ntLnDV9xB1kNjHK1lZ0eaO6gnhc= +github.com/libp2p/go-libp2p v0.35.0/go.mod h1:snyJQix4ET6Tj+LeI0VPjjxTtdWpeOhYt5lEY0KirkQ= +github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94= +github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8= +github.com/libp2p/go-libp2p-pubsub v0.11.0 h1:+JvS8Kty0OiyUiN0i8H5JbaCgjnJTRnTHe4rU88dLFc= +github.com/libp2p/go-libp2p-pubsub v0.11.0/go.mod h1:QEb+hEV9WL9wCiUAnpY29FZR6W3zK8qYlaml8R4q6gQ= +github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= +github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= +github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk= +github.com/libp2p/go-nat v0.2.0/go.mod h1:3MJr+GRpRkyT65EpVPBstXLvOlAPzUVlG6Pwg9ohLJk= +github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU= +github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ= +github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQscQm2s= +github.com/libp2p/go-reuseport v0.4.0/go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8Se6DrI2E1cLU= +github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ= +github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= +github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8= +github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4= +github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPkBY= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= +github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= +github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= +github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= +github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= +github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= +github.com/multiformats/go-multiaddr v0.13.0 h1:BCBzs61E3AGHcYYTv8dqRH43ZfyrqM8RXVPT8t13tLQ= +github.com/multiformats/go-multiaddr v0.13.0/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII= +github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= +github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= +github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= +github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= +github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= +github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= +github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= +github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= +github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= +github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= +github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf/QGkvOGQAyiE= +github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= +github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= +github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= +github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= +github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae h1:FatpGJD2jmJfhZiFDElaC0QhZUDQnxUeAwTGkfAHN3I= +github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= +github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= +github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk= +github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= +github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/pion/datachannel v1.5.6 h1:1IxKJntfSlYkpUj8LlYRSWpYiTTC02nUrOE8T3DqGeg= +github.com/pion/datachannel v1.5.6/go.mod h1:1eKT6Q85pRnr2mHiWHxJwO50SfZRtWHTsNIVb/NfGW4= +github.com/pion/dtls/v2 v2.2.11 h1:9U/dpCYl1ySttROPWJgqWKEylUdT0fXp/xst6JwY5Ks= +github.com/pion/dtls/v2 v2.2.11/go.mod h1:d9SYc9fch0CqK90mRk1dC7AkzzpwJj6u2GU3u+9pqFE= +github.com/pion/ice/v2 v2.3.24 h1:RYgzhH/u5lH0XO+ABatVKCtRd+4U1GEaCXSMjNr13tI= +github.com/pion/ice/v2 v2.3.24/go.mod h1:KXJJcZK7E8WzrBEYnV4UtqEZsGeWfHxsNqhVcVvgjxw= +github.com/pion/interceptor v0.1.29 h1:39fsnlP1U8gw2JzOFWdfCU82vHvhW9o0rZnZF56wF+M= +github.com/pion/interceptor v0.1.29/go.mod h1:ri+LGNjRUc5xUNtDEPzfdkmSqISixVTBF/z/Zms/6T4= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/mdns v0.0.12 h1:CiMYlY+O0azojWDmxdNr7ADGrnZ+V6Ilfner+6mSVK8= +github.com/pion/mdns v0.0.12/go.mod h1:VExJjv8to/6Wqm1FXK+Ii/Z9tsVk/F5sD/N70cnYFbk= +github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= +github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= +github.com/pion/rtcp v1.2.14 h1:KCkGV3vJ+4DAJmvP0vaQShsb0xkRfWkO540Gy102KyE= +github.com/pion/rtcp v1.2.14/go.mod h1:sn6qjxvnwyAkkPzPULIbVqSKI5Dv54Rv7VG0kNxh9L4= +github.com/pion/rtp v1.8.6 h1:MTmn/b0aWWsAzux2AmP8WGllusBVw4NPYPVFFd7jUPw= +github.com/pion/rtp v1.8.6/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU= +github.com/pion/sctp v1.8.16 h1:PKrMs+o9EMLRvFfXq59WFsC+V8mN1wnKzqrv+3D/gYY= +github.com/pion/sctp v1.8.16/go.mod h1:P6PbDVA++OJMrVNg2AL3XtYHV4uD6dvfyOovCgMs0PE= +github.com/pion/sdp/v3 v3.0.9 h1:pX++dCHoHUwq43kuwf3PyJfHlwIj4hXA7Vrifiq0IJY= +github.com/pion/sdp/v3 v3.0.9/go.mod h1:B5xmvENq5IXJimIO4zfp6LAe1fD9N+kFv+V/1lOdz8M= +github.com/pion/srtp/v2 v2.0.18 h1:vKpAXfawO9RtTRKZJbG4y0v1b11NZxQnxRl85kGuUlo= +github.com/pion/srtp/v2 v2.0.18/go.mod h1:0KJQjA99A6/a0DOVTu1PhDSw0CXF2jTkqOoMg3ODqdA= +github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4= +github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8= +github.com/pion/transport/v2 v2.2.5 h1:iyi25i/21gQck4hfRhomF6SktmUQjRsRW4WJdhfc3Kc= +github.com/pion/transport/v2 v2.2.5/go.mod h1:q2U/tf9FEfnSBGSW6w5Qp5PFWRLRj3NjLhCCgpRK4p0= +github.com/pion/turn/v2 v2.1.6 h1:Xr2niVsiPTB0FPtt+yAWKFUkU1eotQbGgpTIld4x1Gc= +github.com/pion/turn/v2 v2.1.6/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY= +github.com/pion/webrtc/v3 v3.2.40 h1:Wtfi6AZMQg+624cvCXUuSmrKWepSB7zfgYDOYqsSOVU= +github.com/pion/webrtc/v3 v3.2.40/go.mod h1:M1RAe3TNTD1tzyvqHrbVODfwdPGSXOUo/OgpoGGJqFY= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= +github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= +github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= +github.com/quic-go/quic-go v0.44.0 h1:So5wOr7jyO4vzL2sd8/pD9Kesciv91zSk8BoFngItQ0= +github.com/quic-go/quic-go v0.44.0/go.mod h1:z4cx/9Ny9UtGITIPzmPTXh1ULfOyWh4qGQlpnPcWmek= +github.com/quic-go/webtransport-go v0.8.0 h1:HxSrwun11U+LlmwpgM1kEqIqH90IT4N8auv/cD7QFJg= +github.com/quic-go/webtransport-go v0.8.0/go.mod h1:N99tjprW432Ut5ONql/aUhSLT0YVSlwHohQsuac9WaM= +github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= +github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rollkit/rollkit v0.13.7 h1:GNWX0tPs02DsLeTc0z8G7rO5PDR0yavT08Umr7O02Ks= +github.com/rollkit/rollkit v0.13.7/go.mod h1:clM4aPsWDJk/IN/SqCBsA+ab0/8gdh+5O4hRkLWKB7s= +github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= +github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= +github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= +github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= +github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= +go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= +go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.21.1 h1:RqBh3cYdzZS0uqwVeEjOX2p73dddLpym315myy/Bpb0= +go.uber.org/fx v1.21.1/go.mod h1:HT2M7d7RHo+ebKGh9NRcrsrHHfpZ60nW3QRubMRfv48= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= +lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= From d192f94012a685f513c5d85a5134df69bb70c81a Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 29 Oct 2024 17:03:58 -0700 Subject: [PATCH 02/43] chore: add docker setup for reth --- README.md | 7 +++++ docker/docker-compose.yml | 57 +++++++++++++++++++++++++++++++++++++++ docker/jwttoken/jwt.hex | 1 + 3 files changed, 65 insertions(+) create mode 100644 README.md create mode 100755 docker/docker-compose.yml create mode 100644 docker/jwttoken/jwt.hex diff --git a/README.md b/README.md new file mode 100644 index 0000000..62787e3 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +## Development + +```bash +$ cd docker +$ docker compose up -d +$ docker compose down +``` diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100755 index 0000000..26853c8 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,57 @@ +name: "reth" + +services: + jwt-init: + container_name: jwt-init + image: alpine + volumes: + - ./jwttoken:/jwt + command: > + /bin/sh -c "mkdir -p /jwt && + if [ ! -f /jwt/jwt.hex ]; then + apk add --no-cache openssl && + openssl rand -hex 32 | tr -d '\n' > /jwt/jwt.hex && + echo '✅ JWT token generated successfully'; + else + echo '✅ JWT token already exists'; + fi" + + reth: + container_name: reth + restart: unless-stopped + image: ghcr.io/paradigmxyz/reth + depends_on: + jwt-init: + condition: service_completed_successfully + ports: + - "9001:9001" # metrics + - "30303:30303" # eth/66 peering + - "8545:8545" # rpc + - "8551:8551" # engine + volumes: + - mainnet_data:/root/.local/share/reth/mainnet + - sepolia_data:/root/.local/share/reth/sepolia + - holesky_data:/root/.local/share/reth/holesky + - logs:/root/logs + - ./jwttoken:/root/jwt:ro + pid: host + command: > + node + --chain sepolia + --metrics 0.0.0.0:9001 + --log.file.directory /root/logs + --authrpc.addr 0.0.0.0 + --authrpc.port 8551 + --authrpc.jwtsecret /root/jwt/jwt.hex + --http --http.addr 0.0.0.0 --http.port 8545 + --http.api "eth,net,web3" + +volumes: + mainnet_data: + driver: local + sepolia_data: + driver: local + holesky_data: + driver: local + logs: + driver: local diff --git a/docker/jwttoken/jwt.hex b/docker/jwttoken/jwt.hex new file mode 100644 index 0000000..6570be3 --- /dev/null +++ b/docker/jwttoken/jwt.hex @@ -0,0 +1 @@ +dba4fde66a8c385e6e96d649ee3c651e923d283cf342d66059447e1079dc737c From adc0ad0b1b25a0f364a14c20c82cf08292a5ae5b Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 29 Oct 2024 17:09:24 -0700 Subject: [PATCH 03/43] chore: gitignore jwt token --- .gitignore | 1 + docker/jwttoken/jwt.hex | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .gitignore delete mode 100644 docker/jwttoken/jwt.hex diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..20b2fe5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +docker/jwttoken/ \ No newline at end of file diff --git a/docker/jwttoken/jwt.hex b/docker/jwttoken/jwt.hex deleted file mode 100644 index 6570be3..0000000 --- a/docker/jwttoken/jwt.hex +++ /dev/null @@ -1 +0,0 @@ -dba4fde66a8c385e6e96d649ee3c651e923d283cf342d66059447e1079dc737c From 8d69c2e9f46573fbf0f68a6a4c0dad7948be5ec2 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 29 Oct 2024 18:51:47 -0700 Subject: [PATCH 04/43] feat: support json-rpc proxy client --- README.md | 73 ++++++++++++++ docker/docker-compose.yml | 5 +- execution.go | 161 ++----------------------------- execution_test.go | 195 ++++++++++++++++++++++++++++++++++++++ go.mod | 8 +- go.sum | 13 ++- 6 files changed, 293 insertions(+), 162 deletions(-) create mode 100644 execution_test.go diff --git a/README.md b/README.md index 62787e3..c889d13 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,76 @@ +## Architecture + +```mermaid +graph LR + subgraph Test Environment + TestClient[Test Client] + MockExecutor[Mock Executor] + end + + subgraph Execution Client + EngineAPIExecutionClient + subgraph Client Components + EthClient[Eth Client] + ProxyClient[JSON-RPC Proxy Client] + end + end + + subgraph Proxy Layer + ProxyServer[JSON-RPC Proxy Server] + end + + subgraph Execution Layer + Reth[Reth Node] + subgraph Reth APIs + EngineAPI[Engine API] + JsonRPC[JSON-RPC API] + end + end + + %% Test Environment Connections + TestClient -->|uses| EngineAPIExecutionClient + ProxyServer -->|delegates to| MockExecutor + + %% Execution Client Connections + EngineAPIExecutionClient -->|eth calls| EthClient + EngineAPIExecutionClient -->|engine calls| ProxyClient + EthClient -->|eth/net/web3| JsonRPC + ProxyClient -->|forwards requests| ProxyServer + + %% Proxy to Reth Connections + ProxyServer -->|authenticated requests| EngineAPI + JsonRPC -->|internal| Reth + EngineAPI -->|internal| Reth + + %% Styling + classDef primary fill:#f9f,stroke:#333,stroke-width:2px + classDef secondary fill:#bbf,stroke:#333,stroke-width:1px + class EngineAPIExecutionClient,ProxyServer primary + class EthClient,ProxyClient,MockExecutor,EngineAPI,JsonRPC secondary +``` + +The architecture consists of several key components: + +1. **Execution Client** + + - `EngineAPIExecutionClient`: Main client interface + - `EthClient`: Handles standard Ethereum JSON-RPC calls + - `ProxyClient`: Handles Engine API calls through the proxy + +2. **Proxy Layer** + + - `JSON-RPC Proxy Server`: Authenticates and forwards Engine API requests + - Handles JWT authentication with Reth + +3. **Execution Layer** + + - `Reth Node`: Ethereum execution client + - Exposes Engine API and standard JSON-RPC endpoints + +4. **Test Environment** + - `Test Client`: Integration tests + - `Mock Executor`: Simulates execution behavior for unit tests + ## Development ```bash diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 26853c8..93cce27 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -10,10 +10,7 @@ services: /bin/sh -c "mkdir -p /jwt && if [ ! -f /jwt/jwt.hex ]; then apk add --no-cache openssl && - openssl rand -hex 32 | tr -d '\n' > /jwt/jwt.hex && - echo '✅ JWT token generated successfully'; - else - echo '✅ JWT token already exists'; + openssl rand -hex 32 | tr -d '\n' > /jwt/jwt.hex; fi" reth: diff --git a/execution.go b/execution.go index 568b791..0bd3303 100644 --- a/execution.go +++ b/execution.go @@ -1,17 +1,13 @@ package execution import ( - "context" "errors" - "fmt" - "math/big" "time" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/rpc" execution "github.com/rollkit/go-execution" + "github.com/rollkit/go-execution/proxy/jsonrpc" rollkitTypes "github.com/rollkit/rollkit/types" ) @@ -31,24 +27,21 @@ var ( type EngineAPIExecutionClient struct { ethClient *ethclient.Client - engineClient *rpc.Client + proxyClient *jsonrpc.Client genesisHash common.Hash feeRecipient common.Address } // NewEngineAPIExecutionClient creates a new instance of EngineAPIExecutionClient. -func NewEngineAPIExecutionClient(ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { +func NewEngineAPIExecutionClient(ethURL string, proxyClient *jsonrpc.Client, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { ethClient, err := ethclient.Dial(ethURL) if err != nil { - return nil, fmt.Errorf("failed to connect to Ethereum client: %w", err) - } - engineClient, err := rpc.Dial(engineURL) - if err != nil { - return nil, fmt.Errorf("failed to connect to Engine API: %w", err) + return nil, err } + return &EngineAPIExecutionClient{ ethClient: ethClient, - engineClient: engineClient, + proxyClient: proxyClient, genesisHash: genesisHash, feeRecipient: feeRecipient, }, nil @@ -62,70 +55,12 @@ func (c *EngineAPIExecutionClient) InitChain( initialHeight uint64, chainID string, ) (rollkitTypes.Hash, uint64, error) { - ctx := context.Background() - var forkchoiceResult map[string]interface{} - err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", - map[string]interface{}{ - "headBlockHash": c.genesisHash, - "safeBlockHash": c.genesisHash, - "finalizedBlockHash": c.genesisHash, - }, - map[string]interface{}{ - "timestamp": genesisTime.Unix(), - "prevRandao": common.Hash{}, // TO-DO - "suggestedFeeRecipient": c.feeRecipient, - }, - ) - if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) - } - payloadID, ok := forkchoiceResult["payloadId"].(string) - if !ok { - return rollkitTypes.Hash{}, 0, ErrNilPayloadStatus - } - var payload map[string]interface{} - err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) - if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) - } - stateRoot := common.HexToHash(payload["stateRoot"].(string)) - gasLimit := uint64(payload["gasLimit"].(float64)) - var rollkitStateRoot rollkitTypes.Hash - copy(rollkitStateRoot[:], stateRoot[:]) - return rollkitStateRoot, gasLimit, nil + return c.proxyClient.InitChain(genesisTime, initialHeight, chainID) } // GetTxs retrieves transactions from the transaction pool. func (c *EngineAPIExecutionClient) GetTxs() ([]rollkitTypes.Tx, error) { - ctx := context.Background() - var result struct { - Pending map[string]map[string]*types.Transaction `json:"pending"` - Queued map[string]map[string]*types.Transaction `json:"queued"` - } - err := c.ethClient.Client().CallContext(ctx, &result, "txpool_content") - if err != nil { - return nil, fmt.Errorf("failed to get tx pool content: %w", err) - } - var txs []rollkitTypes.Tx - for _, accountTxs := range result.Pending { - for _, tx := range accountTxs { - txBytes, err := tx.MarshalBinary() - if err != nil { - return nil, fmt.Errorf("failed to marshal transaction: %w", err) - } - txs = append(txs, rollkitTypes.Tx(txBytes)) - } - } - for _, accountTxs := range result.Queued { - for _, tx := range accountTxs { - txBytes, err := tx.MarshalBinary() - if err != nil { - return nil, fmt.Errorf("failed to marshal transaction: %w", err) - } - txs = append(txs, rollkitTypes.Tx(txBytes)) - } - } - return txs, nil + return c.proxyClient.GetTxs() } // ExecuteTxs executes the given transactions and returns the new state root and gas used. @@ -135,86 +70,10 @@ func (c *EngineAPIExecutionClient) ExecuteTxs( timestamp time.Time, prevStateRoot rollkitTypes.Hash, ) (rollkitTypes.Hash, uint64, error) { - ctx := context.Background() - ethTxs := make([][]byte, len(txs)) - for i, tx := range txs { - ethTxs[i] = tx - } - prevRandao := c.derivePrevRandao(blockHeight) - var forkchoiceResult map[string]interface{} - err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", - map[string]interface{}{ - "headBlockHash": common.BytesToHash(prevStateRoot[:]), - "safeBlockHash": common.BytesToHash(prevStateRoot[:]), - "finalizedBlockHash": common.BytesToHash(prevStateRoot[:]), - }, - map[string]interface{}{ - "timestamp": timestamp.Unix(), - "prevRandao": prevRandao, - "suggestedFeeRecipient": c.feeRecipient, - }, - ) - if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) - } - payloadID, ok := forkchoiceResult["payloadId"].(string) - if !ok { - return rollkitTypes.Hash{}, 0, ErrNilPayloadStatus - } - var payload map[string]interface{} - err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) - if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) - } - payload["transactions"] = ethTxs - var newPayloadResult map[string]interface{} - err = c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", payload) - if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) - } - status, ok := newPayloadResult["status"].(string) - if !ok || PayloadStatus(status) != PayloadStatusValid { - return rollkitTypes.Hash{}, 0, ErrInvalidPayloadStatus - } - newStateRoot := common.HexToHash(payload["stateRoot"].(string)) - gasUsed := uint64(payload["gasUsed"].(float64)) - var rollkitNewStateRoot rollkitTypes.Hash - copy(rollkitNewStateRoot[:], newStateRoot[:]) - return rollkitNewStateRoot, gasUsed, nil + return c.proxyClient.ExecuteTxs(txs, blockHeight, timestamp, prevStateRoot) } // SetFinal marks a block at the given height as final. func (c *EngineAPIExecutionClient) SetFinal(blockHeight uint64) error { - ctx := context.Background() - block, err := c.ethClient.BlockByNumber(ctx, big.NewInt(int64(blockHeight))) - if err != nil { - return fmt.Errorf("failed to get block at height %d: %w", blockHeight, err) - } - var result map[string]interface{} - err = c.engineClient.CallContext(ctx, &result, "engine_forkchoiceUpdatedV1", - map[string]interface{}{ - "headBlockHash": block.Hash(), - "safeBlockHash": block.Hash(), - "finalizedBlockHash": block.Hash(), - }, - nil, // No payload attributes for finalization - ) - if err != nil { - return fmt.Errorf("engine_forkchoiceUpdatedV1 failed for finalization: %w", err) - } - payloadStatus, ok := result["payloadStatus"].(map[string]interface{}) - if !ok { - return ErrNilPayloadStatus - } - status, ok := payloadStatus["status"].(string) - if !ok || PayloadStatus(status) != PayloadStatusValid { - return ErrInvalidPayloadStatus - } - return nil -} - -// derivePrevRandao generates a deterministic prevRandao value based on block height. -func (c *EngineAPIExecutionClient) derivePrevRandao(blockHeight uint64) common.Hash { - // TO-DO - return common.BigToHash(big.NewInt(int64(blockHeight))) + return c.proxyClient.SetFinal(blockHeight) } diff --git a/execution_test.go b/execution_test.go new file mode 100644 index 0000000..b77e14e --- /dev/null +++ b/execution_test.go @@ -0,0 +1,195 @@ +package execution + +import ( + "context" + "math/big" + "net/http/httptest" + "os" + "testing" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/rollkit/go-execution/proxy/jsonrpc" + rollkitTypes "github.com/rollkit/rollkit/types" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" +) + +const ( + jwtSecretFile = "jwt.hex" +) + +type testEnv struct { + server *httptest.Server + jwtSecret string + ethURL string + engineURL string + cleanup func() + client *EngineAPIExecutionClient + proxyConf *jsonrpc.Config + mockExec *MockExecutor +} + +// Add MockExecutor +type MockExecutor struct { + mock.Mock +} + +func NewMockExecutor() *MockExecutor { + return &MockExecutor{} +} + +func (m *MockExecutor) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (rollkitTypes.Hash, uint64, error) { + args := m.Called(genesisTime, initialHeight, chainID) + return args.Get(0).(rollkitTypes.Hash), args.Get(1).(uint64), args.Error(2) +} + +func (m *MockExecutor) GetTxs() ([]rollkitTypes.Tx, error) { + args := m.Called() + return args.Get(0).([]rollkitTypes.Tx), args.Error(1) +} + +func (m *MockExecutor) ExecuteTxs(txs []rollkitTypes.Tx, height uint64, timestamp time.Time, prevStateRoot rollkitTypes.Hash) (rollkitTypes.Hash, uint64, error) { + args := m.Called(txs, height, timestamp, prevStateRoot) + return args.Get(0).(rollkitTypes.Hash), args.Get(1).(uint64), args.Error(2) +} + +func (m *MockExecutor) SetFinal(height uint64) error { + args := m.Called(height) + return args.Error(0) +} + +func setupTestEnv(t *testing.T) *testEnv { + t.Helper() + + // Create temporary directory for JWT token + tmpDir, err := os.MkdirTemp("", "execution-test-*") + require.NoError(t, err) + + // Setup cleanup + cleanup := func() { + os.RemoveAll(tmpDir) + } + + // Setup proxy config + proxyConf := &jsonrpc.Config{ + DefaultTimeout: 5 * time.Second, + MaxRequestSize: 1024 * 1024, + } + + // Create mock executor + mockExec := NewMockExecutor() + + // Create proxy server with mock executor + server := jsonrpc.NewServer(mockExec, proxyConf) + testServer := httptest.NewServer(server) + + // Create proxy client + proxyClient := jsonrpc.NewClient() + proxyClient.SetConfig(proxyConf) + + err = proxyClient.Start(testServer.URL) + require.NoError(t, err) + + // Create execution client with proxy client + ethURL := "http://localhost:8545" + genesisHash := common.HexToHash("0x0") + feeRecipient := common.HexToAddress("0x0") + + client, err := NewEngineAPIExecutionClient( + ethURL, + proxyClient, // Pass the proxy client + genesisHash, + feeRecipient, + ) + require.NoError(t, err) + + return &testEnv{ + server: testServer, + jwtSecret: "", // Not needed for test server + ethURL: ethURL, + cleanup: func() { + cleanup() + testServer.Close() + proxyClient.Stop() + }, + client: client, + proxyConf: proxyConf, + mockExec: mockExec, + } +} + +func TestEngineAPIExecutionClient_InitChain(t *testing.T) { + env := setupTestEnv(t) + defer env.cleanup() + + genesisTime := time.Now().UTC().Truncate(time.Second) + initialHeight := uint64(0) + chainID := "11155111" // Sepolia chain ID + + // Setup mock expectations using env.mockExec + expectedStateRoot := rollkitTypes.Hash{} + copy(expectedStateRoot[:], []byte{1, 2, 3}) + expectedGasLimit := uint64(1000000) + + env.mockExec.On("InitChain", genesisTime, initialHeight, chainID). + Return(expectedStateRoot, expectedGasLimit, nil) + + stateRoot, gasLimit, err := env.client.InitChain(genesisTime, initialHeight, chainID) + require.NoError(t, err) + require.Equal(t, expectedStateRoot, stateRoot) + require.Equal(t, expectedGasLimit, gasLimit) + + env.mockExec.AssertExpectations(t) +} + +func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { + env := setupTestEnv(t) + defer env.cleanup() + + txs, err := env.client.GetTxs() + require.NoError(t, err) + // Initially pool should be empty + require.Empty(t, txs) + + // TO-DO: Add test transaction to pool and verify it's retrieved +} + +func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { + env := setupTestEnv(t) + defer env.cleanup() + + // Setup test data + blockHeight := uint64(1) + timestamp := time.Now() + + // Get the previous state root from the client + header, err := env.client.ethClient.HeaderByNumber(context.Background(), big.NewInt(0)) + require.NoError(t, err) + + // Convert the header root to the expected type + headerHash := rollkitTypes.Hash(header.Root[:]) // Convert to rollkit Hash type + + // Create test transaction + testTx := []byte{} // Add test transaction bytes + + stateRoot, gasUsed, err := env.client.ExecuteTxs( + []rollkitTypes.Tx{testTx}, + blockHeight, + timestamp, + headerHash, + ) + require.NoError(t, err) + require.NotEqual(t, common.Hash{}, stateRoot) + require.Greater(t, gasUsed, uint64(0)) +} + +func TestEngineAPIExecutionClient_SetFinal(t *testing.T) { + env := setupTestEnv(t) + defer env.cleanup() + + // First create a block + blockHeight := uint64(1) + err := env.client.SetFinal(blockHeight) + require.NoError(t, err) +} diff --git a/go.mod b/go.mod index 8a47f38..d5b2fee 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( require ( github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/OneOfOne/xxhash v1.2.8 // indirect github.com/StackExchange/wmi v1.2.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect @@ -59,6 +60,7 @@ require ( github.com/libp2p/go-msgio v0.3.0 // indirect github.com/linxGnu/grocksdb v1.7.16 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect @@ -84,12 +86,12 @@ require ( github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/stretchr/testify v1.9.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/supranational/blst v0.3.13 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect - go.etcd.io/bbolt v1.3.7 // indirect + go.etcd.io/bbolt v1.3.10 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.25.0 // indirect @@ -105,3 +107,5 @@ require ( lukechampine.com/blake3 v1.2.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) + +require github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 6eaf682..e80ba05 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,9 @@ 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/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= +github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= 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= @@ -248,8 +249,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= -github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4= github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPkBY= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= @@ -403,6 +404,8 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -429,8 +432,8 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsr github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= +go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= From 594f3f99ea2166a3fd99f44c86ca8c8899455fc2 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 29 Oct 2024 21:29:41 -0700 Subject: [PATCH 05/43] refactor: separate proxy client from engine api client --- execution.go | 43 ++------- execution_test.go | 127 ++++++++++---------------- proxy/client.go | 226 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 280 insertions(+), 116 deletions(-) create mode 100644 proxy/client.go diff --git a/execution.go b/execution.go index 0bd3303..2835cea 100644 --- a/execution.go +++ b/execution.go @@ -1,49 +1,20 @@ package execution import ( - "errors" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethclient" execution "github.com/rollkit/go-execution" - "github.com/rollkit/go-execution/proxy/jsonrpc" rollkitTypes "github.com/rollkit/rollkit/types" ) -// Define necessary types and constants -type PayloadStatus string - -const ( - PayloadStatusValid PayloadStatus = "VALID" - PayloadStatusInvalid PayloadStatus = "INVALID" - PayloadStatusSyncing PayloadStatus = "SYNCING" -) - -var ( - ErrNilPayloadStatus = errors.New("nil payload status") - ErrInvalidPayloadStatus = errors.New("invalid payload status") -) - type EngineAPIExecutionClient struct { - ethClient *ethclient.Client - proxyClient *jsonrpc.Client - genesisHash common.Hash - feeRecipient common.Address + execute execution.Execute } // NewEngineAPIExecutionClient creates a new instance of EngineAPIExecutionClient. -func NewEngineAPIExecutionClient(ethURL string, proxyClient *jsonrpc.Client, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { - ethClient, err := ethclient.Dial(ethURL) - if err != nil { - return nil, err - } - +func NewEngineAPIExecutionClient(execute execution.Execute) (*EngineAPIExecutionClient, error) { return &EngineAPIExecutionClient{ - ethClient: ethClient, - proxyClient: proxyClient, - genesisHash: genesisHash, - feeRecipient: feeRecipient, + execute: execute, }, nil } @@ -55,12 +26,12 @@ func (c *EngineAPIExecutionClient) InitChain( initialHeight uint64, chainID string, ) (rollkitTypes.Hash, uint64, error) { - return c.proxyClient.InitChain(genesisTime, initialHeight, chainID) + return c.execute.InitChain(genesisTime, initialHeight, chainID) } // GetTxs retrieves transactions from the transaction pool. func (c *EngineAPIExecutionClient) GetTxs() ([]rollkitTypes.Tx, error) { - return c.proxyClient.GetTxs() + return c.execute.GetTxs() } // ExecuteTxs executes the given transactions and returns the new state root and gas used. @@ -70,10 +41,10 @@ func (c *EngineAPIExecutionClient) ExecuteTxs( timestamp time.Time, prevStateRoot rollkitTypes.Hash, ) (rollkitTypes.Hash, uint64, error) { - return c.proxyClient.ExecuteTxs(txs, blockHeight, timestamp, prevStateRoot) + return c.execute.ExecuteTxs(txs, blockHeight, timestamp, prevStateRoot) } // SetFinal marks a block at the given height as final. func (c *EngineAPIExecutionClient) SetFinal(blockHeight uint64) error { - return c.proxyClient.SetFinal(blockHeight) + return c.execute.SetFinal(blockHeight) } diff --git a/execution_test.go b/execution_test.go index b77e14e..641729b 100644 --- a/execution_test.go +++ b/execution_test.go @@ -1,17 +1,16 @@ package execution import ( - "context" - "math/big" "net/http/httptest" "os" "testing" "time" "github.com/ethereum/go-ethereum/common" - "github.com/rollkit/go-execution/proxy/jsonrpc" + "github.com/rollkit/go-execution-evm/proxy" + "github.com/rollkit/go-execution/mocks" + proxyJsonrpc "github.com/rollkit/go-execution/proxy/jsonrpc" rollkitTypes "github.com/rollkit/rollkit/types" - "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" ) @@ -22,92 +21,54 @@ const ( type testEnv struct { server *httptest.Server jwtSecret string - ethURL string - engineURL string cleanup func() client *EngineAPIExecutionClient - proxyConf *jsonrpc.Config - mockExec *MockExecutor -} - -// Add MockExecutor -type MockExecutor struct { - mock.Mock -} - -func NewMockExecutor() *MockExecutor { - return &MockExecutor{} -} - -func (m *MockExecutor) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (rollkitTypes.Hash, uint64, error) { - args := m.Called(genesisTime, initialHeight, chainID) - return args.Get(0).(rollkitTypes.Hash), args.Get(1).(uint64), args.Error(2) -} - -func (m *MockExecutor) GetTxs() ([]rollkitTypes.Tx, error) { - args := m.Called() - return args.Get(0).([]rollkitTypes.Tx), args.Error(1) -} - -func (m *MockExecutor) ExecuteTxs(txs []rollkitTypes.Tx, height uint64, timestamp time.Time, prevStateRoot rollkitTypes.Hash) (rollkitTypes.Hash, uint64, error) { - args := m.Called(txs, height, timestamp, prevStateRoot) - return args.Get(0).(rollkitTypes.Hash), args.Get(1).(uint64), args.Error(2) -} - -func (m *MockExecutor) SetFinal(height uint64) error { - args := m.Called(height) - return args.Error(0) + proxyConf *proxyJsonrpc.Config + mockExec *mocks.MockExecute } func setupTestEnv(t *testing.T) *testEnv { t.Helper() - // Create temporary directory for JWT token tmpDir, err := os.MkdirTemp("", "execution-test-*") require.NoError(t, err) - // Setup cleanup cleanup := func() { os.RemoveAll(tmpDir) } - // Setup proxy config - proxyConf := &jsonrpc.Config{ + // setup a proxy config + proxyConf := &proxyJsonrpc.Config{ DefaultTimeout: 5 * time.Second, MaxRequestSize: 1024 * 1024, } - // Create mock executor - mockExec := NewMockExecutor() + // create a mock execute from mocks package + mockExec := mocks.NewMockExecute(t) - // Create proxy server with mock executor - server := jsonrpc.NewServer(mockExec, proxyConf) + // create a proxy server with mock execute + server := proxyJsonrpc.NewServer(mockExec, proxyConf) testServer := httptest.NewServer(server) - // Create proxy client - proxyClient := jsonrpc.NewClient() - proxyClient.SetConfig(proxyConf) - - err = proxyClient.Start(testServer.URL) - require.NoError(t, err) - - // Create execution client with proxy client + // create a proxy client that implements the Execute interface ethURL := "http://localhost:8545" + engineURL := "http://localhost:8551" genesisHash := common.HexToHash("0x0") feeRecipient := common.HexToAddress("0x0") - client, err := NewEngineAPIExecutionClient( - ethURL, - proxyClient, // Pass the proxy client - genesisHash, - feeRecipient, - ) + proxyClient, err := proxy.NewClient(proxyConf, ethURL, engineURL, genesisHash, feeRecipient) + require.NoError(t, err) + + err = proxyClient.Start(testServer.URL) + require.NoError(t, err) + + // create an execution client with the proxy client + client, err := NewEngineAPIExecutionClient(proxyClient) require.NoError(t, err) return &testEnv{ server: testServer, - jwtSecret: "", // Not needed for test server - ethURL: ethURL, + jwtSecret: "", cleanup: func() { cleanup() testServer.Close() @@ -125,9 +86,8 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { genesisTime := time.Now().UTC().Truncate(time.Second) initialHeight := uint64(0) - chainID := "11155111" // Sepolia chain ID + chainID := "11155111" // sepolia chain id - // Setup mock expectations using env.mockExec expectedStateRoot := rollkitTypes.Hash{} copy(expectedStateRoot[:], []byte{1, 2, 3}) expectedGasLimit := uint64(1000000) @@ -147,49 +107,56 @@ func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { env := setupTestEnv(t) defer env.cleanup() + expectedTxs := []rollkitTypes.Tx{[]byte("tx1"), []byte("tx2")} + env.mockExec.On("GetTxs").Return(expectedTxs, nil) + txs, err := env.client.GetTxs() require.NoError(t, err) - // Initially pool should be empty - require.Empty(t, txs) + require.Equal(t, expectedTxs, txs) - // TO-DO: Add test transaction to pool and verify it's retrieved + env.mockExec.AssertExpectations(t) } func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { env := setupTestEnv(t) defer env.cleanup() - // Setup test data blockHeight := uint64(1) - timestamp := time.Now() - - // Get the previous state root from the client - header, err := env.client.ethClient.HeaderByNumber(context.Background(), big.NewInt(0)) - require.NoError(t, err) + timestamp := time.Now().UTC().Truncate(time.Second) + prevStateRoot := rollkitTypes.Hash{} + copy(prevStateRoot[:], []byte{1, 2, 3}) + testTx := rollkitTypes.Tx("test transaction") - // Convert the header root to the expected type - headerHash := rollkitTypes.Hash(header.Root[:]) // Convert to rollkit Hash type + expectedStateRoot := rollkitTypes.Hash{} + copy(expectedStateRoot[:], []byte{4, 5, 6}) + expectedGasUsed := uint64(21000) - // Create test transaction - testTx := []byte{} // Add test transaction bytes + env.mockExec.On("ExecuteTxs", []rollkitTypes.Tx{testTx}, blockHeight, timestamp, prevStateRoot). + Return(expectedStateRoot, expectedGasUsed, nil) stateRoot, gasUsed, err := env.client.ExecuteTxs( []rollkitTypes.Tx{testTx}, blockHeight, timestamp, - headerHash, + prevStateRoot, ) require.NoError(t, err) - require.NotEqual(t, common.Hash{}, stateRoot) - require.Greater(t, gasUsed, uint64(0)) + require.Equal(t, expectedStateRoot, stateRoot) + require.Equal(t, expectedGasUsed, gasUsed) + + env.mockExec.AssertExpectations(t) } func TestEngineAPIExecutionClient_SetFinal(t *testing.T) { env := setupTestEnv(t) defer env.cleanup() - // First create a block blockHeight := uint64(1) + + env.mockExec.On("SetFinal", blockHeight).Return(nil) + err := env.client.SetFinal(blockHeight) require.NoError(t, err) + + env.mockExec.AssertExpectations(t) } diff --git a/proxy/client.go b/proxy/client.go new file mode 100644 index 0000000..afe7b98 --- /dev/null +++ b/proxy/client.go @@ -0,0 +1,226 @@ +package proxy + +import ( + "context" + "errors" + "fmt" + "math/big" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rpc" + "github.com/rollkit/go-execution" + proxyJsonrpc "github.com/rollkit/go-execution/proxy/jsonrpc" + rollkitTypes "github.com/rollkit/rollkit/types" +) + +type PayloadStatus string + +const ( + PayloadStatusValid PayloadStatus = "VALID" + PayloadStatusInvalid PayloadStatus = "INVALID" + PayloadStatusSyncing PayloadStatus = "SYNCING" +) + +var ( + ErrNilPayloadStatus = errors.New("nil payload status") + ErrInvalidPayloadStatus = errors.New("invalid payload status") +) + +// Ensure ProxyClient implements Execute interface +var _ execution.Execute = (*ProxyClient)(nil) + +// ProxyClient implements the Execute interface in go-execution +type ProxyClient struct { + client *proxyJsonrpc.Client + engineClient *rpc.Client // engine api + ethClient *ethclient.Client + genesisHash common.Hash + feeRecipient common.Address +} + +func NewClient(config *proxyJsonrpc.Config, ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*ProxyClient, error) { + client := proxyJsonrpc.NewClient() + client.SetConfig(config) + + ethClient, err := ethclient.Dial(ethURL) + if err != nil { + return nil, err + } + + engineClient, err := rpc.Dial(engineURL) + if err != nil { + return nil, err + } + + return &ProxyClient{ + client: client, + engineClient: engineClient, + ethClient: ethClient, + genesisHash: genesisHash, + feeRecipient: feeRecipient, + }, nil +} + +// Start starts the proxy client +func (p *ProxyClient) Start(url string) error { + return p.client.Start(url) +} + +// Stop stops the proxy client +func (p *ProxyClient) Stop() { + p.client.Stop() +} + +// Implement the Execute interface +func (p *ProxyClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (rollkitTypes.Hash, uint64, error) { + ctx := context.Background() + var forkchoiceResult map[string]interface{} + err := p.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + map[string]interface{}{ + "headBlockHash": p.genesisHash, + "safeBlockHash": p.genesisHash, + "finalizedBlockHash": p.genesisHash, + }, + map[string]interface{}{ + "timestamp": genesisTime.Unix(), + "prevRandao": common.Hash{}, // TO-DO + "suggestedFeeRecipient": p.feeRecipient, + }, + ) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + } + payloadID, ok := forkchoiceResult["payloadId"].(string) + if !ok { + return rollkitTypes.Hash{}, 0, ErrNilPayloadStatus + } + var payload map[string]interface{} + err = p.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + } + stateRoot := common.HexToHash(payload["stateRoot"].(string)) + gasLimit := uint64(payload["gasLimit"].(float64)) + var rollkitStateRoot rollkitTypes.Hash + copy(rollkitStateRoot[:], stateRoot[:]) + return rollkitStateRoot, gasLimit, nil +} + +func (p *ProxyClient) GetTxs() ([]rollkitTypes.Tx, error) { + ctx := context.Background() + var result struct { + Pending map[string]map[string]*types.Transaction `json:"pending"` + Queued map[string]map[string]*types.Transaction `json:"queued"` + } + err := p.ethClient.Client().CallContext(ctx, &result, "txpool_content") + if err != nil { + return nil, fmt.Errorf("failed to get tx pool content: %w", err) + } + var txs []rollkitTypes.Tx + for _, accountTxs := range result.Pending { + for _, tx := range accountTxs { + txBytes, err := tx.MarshalBinary() + if err != nil { + return nil, fmt.Errorf("failed to marshal transaction: %w", err) + } + txs = append(txs, rollkitTypes.Tx(txBytes)) + } + } + for _, accountTxs := range result.Queued { + for _, tx := range accountTxs { + txBytes, err := tx.MarshalBinary() + if err != nil { + return nil, fmt.Errorf("failed to marshal transaction: %w", err) + } + txs = append(txs, rollkitTypes.Tx(txBytes)) + } + } + return txs, nil +} + +func (p *ProxyClient) ExecuteTxs(txs []rollkitTypes.Tx, height uint64, timestamp time.Time, prevStateRoot rollkitTypes.Hash) (rollkitTypes.Hash, uint64, error) { + ctx := context.Background() + ethTxs := make([][]byte, len(txs)) + for i, tx := range txs { + ethTxs[i] = tx + } + prevRandao := p.derivePrevRandao(height) + var forkchoiceResult map[string]interface{} + err := p.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + map[string]interface{}{ + "headBlockHash": common.BytesToHash(prevStateRoot[:]), + "safeBlockHash": common.BytesToHash(prevStateRoot[:]), + "finalizedBlockHash": common.BytesToHash(prevStateRoot[:]), + }, + map[string]interface{}{ + "timestamp": timestamp.Unix(), + "prevRandao": prevRandao, + "suggestedFeeRecipient": p.feeRecipient, + }, + ) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + } + payloadID, ok := forkchoiceResult["payloadId"].(string) + if !ok { + return rollkitTypes.Hash{}, 0, ErrNilPayloadStatus + } + var payload map[string]interface{} + err = p.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + } + payload["transactions"] = ethTxs + var newPayloadResult map[string]interface{} + err = p.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", payload) + if err != nil { + return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) + } + status, ok := newPayloadResult["status"].(string) + if !ok || PayloadStatus(status) != PayloadStatusValid { + return rollkitTypes.Hash{}, 0, ErrInvalidPayloadStatus + } + newStateRoot := common.HexToHash(payload["stateRoot"].(string)) + gasUsed := uint64(payload["gasUsed"].(float64)) + var rollkitNewStateRoot rollkitTypes.Hash + copy(rollkitNewStateRoot[:], newStateRoot[:]) + return rollkitNewStateRoot, gasUsed, nil +} + +func (p *ProxyClient) SetFinal(height uint64) error { + ctx := context.Background() + block, err := p.ethClient.BlockByNumber(ctx, big.NewInt(int64(height))) + if err != nil { + return fmt.Errorf("failed to get block at height %d: %w", height, err) + } + var result map[string]interface{} + err = p.engineClient.CallContext(ctx, &result, "engine_forkchoiceUpdatedV1", + map[string]interface{}{ + "headBlockHash": block.Hash(), + "safeBlockHash": block.Hash(), + "finalizedBlockHash": block.Hash(), + }, + nil, // No payload attributes for finalization + ) + if err != nil { + return fmt.Errorf("engine_forkchoiceUpdatedV1 failed for finalization: %w", err) + } + payloadStatus, ok := result["payloadStatus"].(map[string]interface{}) + if !ok { + return ErrNilPayloadStatus + } + status, ok := payloadStatus["status"].(string) + if !ok || PayloadStatus(status) != PayloadStatusValid { + return ErrInvalidPayloadStatus + } + return nil +} + +// derivePrevRandao generates a deterministic prevRandao value based on block height. +func (p *ProxyClient) derivePrevRandao(blockHeight uint64) common.Hash { + // TO-DO + return common.BigToHash(big.NewInt(int64(blockHeight))) +} From e845c33f1f5a0548edbe0f591452f05e53b64dad Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 29 Oct 2024 21:51:23 -0700 Subject: [PATCH 06/43] chore: naming changes --- execution_test.go | 8 ++++---- proxy/client.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/execution_test.go b/execution_test.go index 641729b..5a98a69 100644 --- a/execution_test.go +++ b/execution_test.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/rollkit/go-execution-evm/proxy" "github.com/rollkit/go-execution/mocks" - proxyJsonrpc "github.com/rollkit/go-execution/proxy/jsonrpc" + proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" rollkitTypes "github.com/rollkit/rollkit/types" "github.com/stretchr/testify/require" ) @@ -23,7 +23,7 @@ type testEnv struct { jwtSecret string cleanup func() client *EngineAPIExecutionClient - proxyConf *proxyJsonrpc.Config + proxyConf *proxy_json_rpc.Config mockExec *mocks.MockExecute } @@ -38,7 +38,7 @@ func setupTestEnv(t *testing.T) *testEnv { } // setup a proxy config - proxyConf := &proxyJsonrpc.Config{ + proxyConf := &proxy_json_rpc.Config{ DefaultTimeout: 5 * time.Second, MaxRequestSize: 1024 * 1024, } @@ -47,7 +47,7 @@ func setupTestEnv(t *testing.T) *testEnv { mockExec := mocks.NewMockExecute(t) // create a proxy server with mock execute - server := proxyJsonrpc.NewServer(mockExec, proxyConf) + server := proxy_json_rpc.NewServer(mockExec, proxyConf) testServer := httptest.NewServer(server) // create a proxy client that implements the Execute interface diff --git a/proxy/client.go b/proxy/client.go index afe7b98..a5b0d37 100644 --- a/proxy/client.go +++ b/proxy/client.go @@ -12,7 +12,7 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" "github.com/rollkit/go-execution" - proxyJsonrpc "github.com/rollkit/go-execution/proxy/jsonrpc" + proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" rollkitTypes "github.com/rollkit/rollkit/types" ) @@ -34,15 +34,15 @@ var _ execution.Execute = (*ProxyClient)(nil) // ProxyClient implements the Execute interface in go-execution type ProxyClient struct { - client *proxyJsonrpc.Client + client *proxy_json_rpc.Client engineClient *rpc.Client // engine api ethClient *ethclient.Client genesisHash common.Hash feeRecipient common.Address } -func NewClient(config *proxyJsonrpc.Config, ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*ProxyClient, error) { - client := proxyJsonrpc.NewClient() +func NewClient(config *proxy_json_rpc.Config, ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*ProxyClient, error) { + client := proxy_json_rpc.NewClient() client.SetConfig(config) ethClient, err := ethclient.Dial(ethURL) From c7cfbef5dd5fe531a78be29cfe55d9900ce732d0 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 5 Nov 2024 15:32:25 -0800 Subject: [PATCH 07/43] chore: address initial PR review comments --- docker/docker-compose.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 93cce27..b3f3f65 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -3,9 +3,14 @@ name: "reth" services: jwt-init: container_name: jwt-init - image: alpine + image: alpine:3.19 volumes: - ./jwttoken:/jwt + healthcheck: + test: ["CMD", "test", "-f", "/jwt/jwt.hex"] + interval: 5s + timeout: 5s + retries: 3 command: > /bin/sh -c "mkdir -p /jwt && if [ ! -f /jwt/jwt.hex ]; then From d74ca6e408f8ad390bb32c4eac2ccf9455622540 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 5 Nov 2024 15:32:56 -0800 Subject: [PATCH 08/43] chore: address initial PR review comments batch II --- .gitignore | 3 ++- execution.go | 12 ++++++------ execution_test.go | 16 ++++++++-------- proxy/client.go | 46 ++++++++++++++++++++++++++++------------------ 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 20b2fe5..234067c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -docker/jwttoken/ \ No newline at end of file +docker/jwttoken/* +!docker/jwttoken/.gitkeep \ No newline at end of file diff --git a/execution.go b/execution.go index 2835cea..2e51b12 100644 --- a/execution.go +++ b/execution.go @@ -4,7 +4,7 @@ import ( "time" execution "github.com/rollkit/go-execution" - rollkitTypes "github.com/rollkit/rollkit/types" + rollkit_types "github.com/rollkit/rollkit/types" ) type EngineAPIExecutionClient struct { @@ -25,22 +25,22 @@ func (c *EngineAPIExecutionClient) InitChain( genesisTime time.Time, initialHeight uint64, chainID string, -) (rollkitTypes.Hash, uint64, error) { +) (rollkit_types.Hash, uint64, error) { return c.execute.InitChain(genesisTime, initialHeight, chainID) } // GetTxs retrieves transactions from the transaction pool. -func (c *EngineAPIExecutionClient) GetTxs() ([]rollkitTypes.Tx, error) { +func (c *EngineAPIExecutionClient) GetTxs() ([]rollkit_types.Tx, error) { return c.execute.GetTxs() } // ExecuteTxs executes the given transactions and returns the new state root and gas used. func (c *EngineAPIExecutionClient) ExecuteTxs( - txs []rollkitTypes.Tx, + txs []rollkit_types.Tx, blockHeight uint64, timestamp time.Time, - prevStateRoot rollkitTypes.Hash, -) (rollkitTypes.Hash, uint64, error) { + prevStateRoot rollkit_types.Hash, +) (rollkit_types.Hash, uint64, error) { return c.execute.ExecuteTxs(txs, blockHeight, timestamp, prevStateRoot) } diff --git a/execution_test.go b/execution_test.go index 5a98a69..90d7e7e 100644 --- a/execution_test.go +++ b/execution_test.go @@ -10,7 +10,7 @@ import ( "github.com/rollkit/go-execution-evm/proxy" "github.com/rollkit/go-execution/mocks" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - rollkitTypes "github.com/rollkit/rollkit/types" + rollkit_types "github.com/rollkit/rollkit/types" "github.com/stretchr/testify/require" ) @@ -88,7 +88,7 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { initialHeight := uint64(0) chainID := "11155111" // sepolia chain id - expectedStateRoot := rollkitTypes.Hash{} + expectedStateRoot := rollkit_types.Hash{} copy(expectedStateRoot[:], []byte{1, 2, 3}) expectedGasLimit := uint64(1000000) @@ -107,7 +107,7 @@ func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { env := setupTestEnv(t) defer env.cleanup() - expectedTxs := []rollkitTypes.Tx{[]byte("tx1"), []byte("tx2")} + expectedTxs := []rollkit_types.Tx{[]byte("tx1"), []byte("tx2")} env.mockExec.On("GetTxs").Return(expectedTxs, nil) txs, err := env.client.GetTxs() @@ -123,19 +123,19 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { blockHeight := uint64(1) timestamp := time.Now().UTC().Truncate(time.Second) - prevStateRoot := rollkitTypes.Hash{} + prevStateRoot := rollkit_types.Hash{} copy(prevStateRoot[:], []byte{1, 2, 3}) - testTx := rollkitTypes.Tx("test transaction") + testTx := rollkit_types.Tx("test transaction") - expectedStateRoot := rollkitTypes.Hash{} + expectedStateRoot := rollkit_types.Hash{} copy(expectedStateRoot[:], []byte{4, 5, 6}) expectedGasUsed := uint64(21000) - env.mockExec.On("ExecuteTxs", []rollkitTypes.Tx{testTx}, blockHeight, timestamp, prevStateRoot). + env.mockExec.On("ExecuteTxs", []rollkit_types.Tx{testTx}, blockHeight, timestamp, prevStateRoot). Return(expectedStateRoot, expectedGasUsed, nil) stateRoot, gasUsed, err := env.client.ExecuteTxs( - []rollkitTypes.Tx{testTx}, + []rollkit_types.Tx{testTx}, blockHeight, timestamp, prevStateRoot, diff --git a/proxy/client.go b/proxy/client.go index a5b0d37..0c0b7e6 100644 --- a/proxy/client.go +++ b/proxy/client.go @@ -13,7 +13,7 @@ import ( "github.com/ethereum/go-ethereum/rpc" "github.com/rollkit/go-execution" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - rollkitTypes "github.com/rollkit/rollkit/types" + rollkit_types "github.com/rollkit/rollkit/types" ) type PayloadStatus string @@ -69,13 +69,23 @@ func (p *ProxyClient) Start(url string) error { return p.client.Start(url) } -// Stop stops the proxy client +// Stop stops the proxy client and closes all connections func (p *ProxyClient) Stop() { p.client.Stop() + + // Close the engine client connection + if p.engineClient != nil { + p.engineClient.Close() + } + + // Close the eth client connection + if p.ethClient != nil { + p.ethClient.Close() + } } // Implement the Execute interface -func (p *ProxyClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (rollkitTypes.Hash, uint64, error) { +func (p *ProxyClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (rollkit_types.Hash, uint64, error) { ctx := context.Background() var forkchoiceResult map[string]interface{} err := p.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", @@ -91,25 +101,25 @@ func (p *ProxyClient) InitChain(genesisTime time.Time, initialHeight uint64, cha }, ) if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) } payloadID, ok := forkchoiceResult["payloadId"].(string) if !ok { - return rollkitTypes.Hash{}, 0, ErrNilPayloadStatus + return rollkit_types.Hash{}, 0, ErrNilPayloadStatus } var payload map[string]interface{} err = p.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) } stateRoot := common.HexToHash(payload["stateRoot"].(string)) gasLimit := uint64(payload["gasLimit"].(float64)) - var rollkitStateRoot rollkitTypes.Hash + var rollkitStateRoot rollkit_types.Hash copy(rollkitStateRoot[:], stateRoot[:]) return rollkitStateRoot, gasLimit, nil } -func (p *ProxyClient) GetTxs() ([]rollkitTypes.Tx, error) { +func (p *ProxyClient) GetTxs() ([]rollkit_types.Tx, error) { ctx := context.Background() var result struct { Pending map[string]map[string]*types.Transaction `json:"pending"` @@ -119,14 +129,14 @@ func (p *ProxyClient) GetTxs() ([]rollkitTypes.Tx, error) { if err != nil { return nil, fmt.Errorf("failed to get tx pool content: %w", err) } - var txs []rollkitTypes.Tx + var txs []rollkit_types.Tx for _, accountTxs := range result.Pending { for _, tx := range accountTxs { txBytes, err := tx.MarshalBinary() if err != nil { return nil, fmt.Errorf("failed to marshal transaction: %w", err) } - txs = append(txs, rollkitTypes.Tx(txBytes)) + txs = append(txs, rollkit_types.Tx(txBytes)) } } for _, accountTxs := range result.Queued { @@ -135,13 +145,13 @@ func (p *ProxyClient) GetTxs() ([]rollkitTypes.Tx, error) { if err != nil { return nil, fmt.Errorf("failed to marshal transaction: %w", err) } - txs = append(txs, rollkitTypes.Tx(txBytes)) + txs = append(txs, rollkit_types.Tx(txBytes)) } } return txs, nil } -func (p *ProxyClient) ExecuteTxs(txs []rollkitTypes.Tx, height uint64, timestamp time.Time, prevStateRoot rollkitTypes.Hash) (rollkitTypes.Hash, uint64, error) { +func (p *ProxyClient) ExecuteTxs(txs []rollkit_types.Tx, height uint64, timestamp time.Time, prevStateRoot rollkit_types.Hash) (rollkit_types.Hash, uint64, error) { ctx := context.Background() ethTxs := make([][]byte, len(txs)) for i, tx := range txs { @@ -162,30 +172,30 @@ func (p *ProxyClient) ExecuteTxs(txs []rollkitTypes.Tx, height uint64, timestamp }, ) if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) } payloadID, ok := forkchoiceResult["payloadId"].(string) if !ok { - return rollkitTypes.Hash{}, 0, ErrNilPayloadStatus + return rollkit_types.Hash{}, 0, ErrNilPayloadStatus } var payload map[string]interface{} err = p.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) } payload["transactions"] = ethTxs var newPayloadResult map[string]interface{} err = p.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", payload) if err != nil { - return rollkitTypes.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) } status, ok := newPayloadResult["status"].(string) if !ok || PayloadStatus(status) != PayloadStatusValid { - return rollkitTypes.Hash{}, 0, ErrInvalidPayloadStatus + return rollkit_types.Hash{}, 0, ErrInvalidPayloadStatus } newStateRoot := common.HexToHash(payload["stateRoot"].(string)) gasUsed := uint64(payload["gasUsed"].(float64)) - var rollkitNewStateRoot rollkitTypes.Hash + var rollkitNewStateRoot rollkit_types.Hash copy(rollkitNewStateRoot[:], newStateRoot[:]) return rollkitNewStateRoot, gasUsed, nil } From 207cbc3a4f7751f377850d967c96f7b385285b5c Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 5 Nov 2024 18:00:57 -0800 Subject: [PATCH 09/43] refactor: remove redundant abstraction in the proxy layer --- README.md | 32 ++---- execution.go | 251 +++++++++++++++++++++++++++++++++++++++++----- execution_test.go | 11 +- proxy/client.go | 236 ------------------------------------------- 4 files changed, 240 insertions(+), 290 deletions(-) delete mode 100644 proxy/client.go diff --git a/README.md b/README.md index c889d13..b520a50 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,10 @@ graph LR EngineAPIExecutionClient subgraph Client Components EthClient[Eth Client] - ProxyClient[JSON-RPC Proxy Client] + JsonRpcClient[JSON-RPC Client] end end - subgraph Proxy Layer - ProxyServer[JSON-RPC Proxy Server] - end - subgraph Execution Layer Reth[Reth Node] subgraph Reth APIs @@ -29,45 +25,39 @@ graph LR %% Test Environment Connections TestClient -->|uses| EngineAPIExecutionClient - ProxyServer -->|delegates to| MockExecutor + JsonRpcClient -->|test mode| MockExecutor %% Execution Client Connections EngineAPIExecutionClient -->|eth calls| EthClient - EngineAPIExecutionClient -->|engine calls| ProxyClient + EngineAPIExecutionClient -->|engine calls| JsonRpcClient EthClient -->|eth/net/web3| JsonRPC - ProxyClient -->|forwards requests| ProxyServer + JsonRpcClient -->|engine api| EngineAPI - %% Proxy to Reth Connections - ProxyServer -->|authenticated requests| EngineAPI + %% Reth Internal Connections JsonRPC -->|internal| Reth EngineAPI -->|internal| Reth %% Styling classDef primary fill:#f9f,stroke:#333,stroke-width:2px classDef secondary fill:#bbf,stroke:#333,stroke-width:1px - class EngineAPIExecutionClient,ProxyServer primary - class EthClient,ProxyClient,MockExecutor,EngineAPI,JsonRPC secondary + class EngineAPIExecutionClient primary + class EthClient,JsonRpcClient,MockExecutor,EngineAPI,JsonRPC secondary ``` The architecture consists of several key components: 1. **Execution Client** - - `EngineAPIExecutionClient`: Main client interface + - `EngineAPIExecutionClient`: Main client interface that implements the Execute interface - `EthClient`: Handles standard Ethereum JSON-RPC calls - - `ProxyClient`: Handles Engine API calls through the proxy - -2. **Proxy Layer** - - - `JSON-RPC Proxy Server`: Authenticates and forwards Engine API requests - - Handles JWT authentication with Reth + - `JsonRpcClient`: Handles Engine API calls -3. **Execution Layer** +2. **Execution Layer** - `Reth Node`: Ethereum execution client - Exposes Engine API and standard JSON-RPC endpoints -4. **Test Environment** +3. **Test Environment** - `Test Client`: Integration tests - `Mock Executor`: Simulates execution behavior for unit tests diff --git a/execution.go b/execution.go index 2e51b12..87a2aa7 100644 --- a/execution.go +++ b/execution.go @@ -1,50 +1,251 @@ package execution import ( + "context" + "errors" + "fmt" + "math/big" "time" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rpc" execution "github.com/rollkit/go-execution" + proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" rollkit_types "github.com/rollkit/rollkit/types" ) +type PayloadStatus string + +const ( + PayloadStatusValid PayloadStatus = "VALID" + PayloadStatusInvalid PayloadStatus = "INVALID" + PayloadStatusSyncing PayloadStatus = "SYNCING" +) + +var ( + ErrNilPayloadStatus = errors.New("nil payload status") + ErrInvalidPayloadStatus = errors.New("invalid payload status") +) + +// Ensure EngineAPIExecutionClient implements the execution.Execute interface +var _ execution.Execute = (*EngineAPIExecutionClient)(nil) + +// EngineAPIExecutionClient implements the execution.Execute interface type EngineAPIExecutionClient struct { - execute execution.Execute + client *proxy_json_rpc.Client + engineClient *rpc.Client // engine api + ethClient *ethclient.Client + genesisHash common.Hash + feeRecipient common.Address } -// NewEngineAPIExecutionClient creates a new instance of EngineAPIExecutionClient. -func NewEngineAPIExecutionClient(execute execution.Execute) (*EngineAPIExecutionClient, error) { +// NewEngineAPIExecutionClient creates a new instance of EngineAPIExecutionClient +func NewEngineAPIExecutionClient(config *proxy_json_rpc.Config, ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { + client := proxy_json_rpc.NewClient() + client.SetConfig(config) + + ethClient, err := ethclient.Dial(ethURL) + if err != nil { + return nil, err + } + + engineClient, err := rpc.Dial(engineURL) + if err != nil { + return nil, err + } + return &EngineAPIExecutionClient{ - execute: execute, + client: client, + engineClient: engineClient, + ethClient: ethClient, + genesisHash: genesisHash, + feeRecipient: feeRecipient, }, nil } -var _ execution.Execute = (*EngineAPIExecutionClient)(nil) +// Start starts the execution client +func (c *EngineAPIExecutionClient) Start(url string) error { + return c.client.Start(url) +} + +// Stop stops the execution client and closes all connections +func (c *EngineAPIExecutionClient) Stop() { + c.client.Stop() + + if c.engineClient != nil { + c.engineClient.Close() + } + + if c.ethClient != nil { + c.ethClient.Close() + } +} -// InitChain initializes the blockchain with genesis information. -func (c *EngineAPIExecutionClient) InitChain( - genesisTime time.Time, - initialHeight uint64, - chainID string, -) (rollkit_types.Hash, uint64, error) { - return c.execute.InitChain(genesisTime, initialHeight, chainID) +// InitChain initializes the blockchain with genesis information +func (c *EngineAPIExecutionClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (rollkit_types.Hash, uint64, error) { + ctx := context.Background() + var forkchoiceResult map[string]interface{} + err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + map[string]interface{}{ + "headBlockHash": c.genesisHash, + "safeBlockHash": c.genesisHash, + "finalizedBlockHash": c.genesisHash, + }, + map[string]interface{}{ + "timestamp": genesisTime.Unix(), + "prevRandao": common.Hash{}, + "suggestedFeeRecipient": c.feeRecipient, + }, + ) + if err != nil { + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + } + + payloadID, ok := forkchoiceResult["payloadId"].(string) + if !ok { + return rollkit_types.Hash{}, 0, ErrNilPayloadStatus + } + + var payload map[string]interface{} + err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) + if err != nil { + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + } + + stateRoot := common.HexToHash(payload["stateRoot"].(string)) + gasLimit := uint64(payload["gasLimit"].(float64)) + var rollkitStateRoot rollkit_types.Hash + copy(rollkitStateRoot[:], stateRoot[:]) + return rollkitStateRoot, gasLimit, nil } -// GetTxs retrieves transactions from the transaction pool. +// GetTxs retrieves transactions from the transaction pool func (c *EngineAPIExecutionClient) GetTxs() ([]rollkit_types.Tx, error) { - return c.execute.GetTxs() + ctx := context.Background() + var result struct { + Pending map[string]map[string]*types.Transaction `json:"pending"` + Queued map[string]map[string]*types.Transaction `json:"queued"` + } + err := c.ethClient.Client().CallContext(ctx, &result, "txpool_content") + if err != nil { + return nil, fmt.Errorf("failed to get tx pool content: %w", err) + } + + var txs []rollkit_types.Tx + for _, accountTxs := range result.Pending { + for _, tx := range accountTxs { + txBytes, err := tx.MarshalBinary() + if err != nil { + return nil, fmt.Errorf("failed to marshal transaction: %w", err) + } + txs = append(txs, rollkit_types.Tx(txBytes)) + } + } + for _, accountTxs := range result.Queued { + for _, tx := range accountTxs { + txBytes, err := tx.MarshalBinary() + if err != nil { + return nil, fmt.Errorf("failed to marshal transaction: %w", err) + } + txs = append(txs, rollkit_types.Tx(txBytes)) + } + } + return txs, nil +} + +// ExecuteTxs executes the given transactions and returns the new state root and gas used +func (c *EngineAPIExecutionClient) ExecuteTxs(txs []rollkit_types.Tx, height uint64, timestamp time.Time, prevStateRoot rollkit_types.Hash) (rollkit_types.Hash, uint64, error) { + ctx := context.Background() + ethTxs := make([][]byte, len(txs)) + for i, tx := range txs { + ethTxs[i] = tx + } + + prevRandao := c.derivePrevRandao(height) + var forkchoiceResult map[string]interface{} + err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + map[string]interface{}{ + "headBlockHash": common.BytesToHash(prevStateRoot[:]), + "safeBlockHash": common.BytesToHash(prevStateRoot[:]), + "finalizedBlockHash": common.BytesToHash(prevStateRoot[:]), + }, + map[string]interface{}{ + "timestamp": timestamp.Unix(), + "prevRandao": prevRandao, + "suggestedFeeRecipient": c.feeRecipient, + }, + ) + if err != nil { + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + } + + payloadID, ok := forkchoiceResult["payloadId"].(string) + if !ok { + return rollkit_types.Hash{}, 0, ErrNilPayloadStatus + } + + var payload map[string]interface{} + err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) + if err != nil { + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + } + + payload["transactions"] = ethTxs + var newPayloadResult map[string]interface{} + err = c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", payload) + if err != nil { + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) + } + + status, ok := newPayloadResult["status"].(string) + if !ok || PayloadStatus(status) != PayloadStatusValid { + return rollkit_types.Hash{}, 0, ErrInvalidPayloadStatus + } + + newStateRoot := common.HexToHash(payload["stateRoot"].(string)) + gasUsed := uint64(payload["gasUsed"].(float64)) + var rollkitNewStateRoot rollkit_types.Hash + copy(rollkitNewStateRoot[:], newStateRoot[:]) + return rollkitNewStateRoot, gasUsed, nil } -// ExecuteTxs executes the given transactions and returns the new state root and gas used. -func (c *EngineAPIExecutionClient) ExecuteTxs( - txs []rollkit_types.Tx, - blockHeight uint64, - timestamp time.Time, - prevStateRoot rollkit_types.Hash, -) (rollkit_types.Hash, uint64, error) { - return c.execute.ExecuteTxs(txs, blockHeight, timestamp, prevStateRoot) +// SetFinal marks a block at the given height as final +func (c *EngineAPIExecutionClient) SetFinal(height uint64) error { + ctx := context.Background() + block, err := c.ethClient.BlockByNumber(ctx, big.NewInt(int64(height))) + if err != nil { + return fmt.Errorf("failed to get block at height %d: %w", height, err) + } + + var result map[string]interface{} + err = c.engineClient.CallContext(ctx, &result, "engine_forkchoiceUpdatedV1", + map[string]interface{}{ + "headBlockHash": block.Hash(), + "safeBlockHash": block.Hash(), + "finalizedBlockHash": block.Hash(), + }, + nil, // No payload attributes for finalization + ) + if err != nil { + return fmt.Errorf("engine_forkchoiceUpdatedV1 failed for finalization: %w", err) + } + + payloadStatus, ok := result["payloadStatus"].(map[string]interface{}) + if !ok { + return ErrNilPayloadStatus + } + + status, ok := payloadStatus["status"].(string) + if !ok || PayloadStatus(status) != PayloadStatusValid { + return ErrInvalidPayloadStatus + } + + return nil } -// SetFinal marks a block at the given height as final. -func (c *EngineAPIExecutionClient) SetFinal(blockHeight uint64) error { - return c.execute.SetFinal(blockHeight) +// derivePrevRandao generates a deterministic prevRandao value based on block height +func (c *EngineAPIExecutionClient) derivePrevRandao(blockHeight uint64) common.Hash { + return common.BigToHash(big.NewInt(int64(blockHeight))) } diff --git a/execution_test.go b/execution_test.go index 90d7e7e..c4b4945 100644 --- a/execution_test.go +++ b/execution_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/ethereum/go-ethereum/common" - "github.com/rollkit/go-execution-evm/proxy" "github.com/rollkit/go-execution/mocks" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" rollkit_types "github.com/rollkit/rollkit/types" @@ -56,14 +55,10 @@ func setupTestEnv(t *testing.T) *testEnv { genesisHash := common.HexToHash("0x0") feeRecipient := common.HexToAddress("0x0") - proxyClient, err := proxy.NewClient(proxyConf, ethURL, engineURL, genesisHash, feeRecipient) + client, err := NewEngineAPIExecutionClient(proxyConf, ethURL, engineURL, genesisHash, feeRecipient) require.NoError(t, err) - err = proxyClient.Start(testServer.URL) - require.NoError(t, err) - - // create an execution client with the proxy client - client, err := NewEngineAPIExecutionClient(proxyClient) + err = client.Start(testServer.URL) require.NoError(t, err) return &testEnv{ @@ -72,7 +67,7 @@ func setupTestEnv(t *testing.T) *testEnv { cleanup: func() { cleanup() testServer.Close() - proxyClient.Stop() + client.Stop() }, client: client, proxyConf: proxyConf, diff --git a/proxy/client.go b/proxy/client.go deleted file mode 100644 index 0c0b7e6..0000000 --- a/proxy/client.go +++ /dev/null @@ -1,236 +0,0 @@ -package proxy - -import ( - "context" - "errors" - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/rpc" - "github.com/rollkit/go-execution" - proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - rollkit_types "github.com/rollkit/rollkit/types" -) - -type PayloadStatus string - -const ( - PayloadStatusValid PayloadStatus = "VALID" - PayloadStatusInvalid PayloadStatus = "INVALID" - PayloadStatusSyncing PayloadStatus = "SYNCING" -) - -var ( - ErrNilPayloadStatus = errors.New("nil payload status") - ErrInvalidPayloadStatus = errors.New("invalid payload status") -) - -// Ensure ProxyClient implements Execute interface -var _ execution.Execute = (*ProxyClient)(nil) - -// ProxyClient implements the Execute interface in go-execution -type ProxyClient struct { - client *proxy_json_rpc.Client - engineClient *rpc.Client // engine api - ethClient *ethclient.Client - genesisHash common.Hash - feeRecipient common.Address -} - -func NewClient(config *proxy_json_rpc.Config, ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*ProxyClient, error) { - client := proxy_json_rpc.NewClient() - client.SetConfig(config) - - ethClient, err := ethclient.Dial(ethURL) - if err != nil { - return nil, err - } - - engineClient, err := rpc.Dial(engineURL) - if err != nil { - return nil, err - } - - return &ProxyClient{ - client: client, - engineClient: engineClient, - ethClient: ethClient, - genesisHash: genesisHash, - feeRecipient: feeRecipient, - }, nil -} - -// Start starts the proxy client -func (p *ProxyClient) Start(url string) error { - return p.client.Start(url) -} - -// Stop stops the proxy client and closes all connections -func (p *ProxyClient) Stop() { - p.client.Stop() - - // Close the engine client connection - if p.engineClient != nil { - p.engineClient.Close() - } - - // Close the eth client connection - if p.ethClient != nil { - p.ethClient.Close() - } -} - -// Implement the Execute interface -func (p *ProxyClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (rollkit_types.Hash, uint64, error) { - ctx := context.Background() - var forkchoiceResult map[string]interface{} - err := p.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", - map[string]interface{}{ - "headBlockHash": p.genesisHash, - "safeBlockHash": p.genesisHash, - "finalizedBlockHash": p.genesisHash, - }, - map[string]interface{}{ - "timestamp": genesisTime.Unix(), - "prevRandao": common.Hash{}, // TO-DO - "suggestedFeeRecipient": p.feeRecipient, - }, - ) - if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) - } - payloadID, ok := forkchoiceResult["payloadId"].(string) - if !ok { - return rollkit_types.Hash{}, 0, ErrNilPayloadStatus - } - var payload map[string]interface{} - err = p.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) - if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) - } - stateRoot := common.HexToHash(payload["stateRoot"].(string)) - gasLimit := uint64(payload["gasLimit"].(float64)) - var rollkitStateRoot rollkit_types.Hash - copy(rollkitStateRoot[:], stateRoot[:]) - return rollkitStateRoot, gasLimit, nil -} - -func (p *ProxyClient) GetTxs() ([]rollkit_types.Tx, error) { - ctx := context.Background() - var result struct { - Pending map[string]map[string]*types.Transaction `json:"pending"` - Queued map[string]map[string]*types.Transaction `json:"queued"` - } - err := p.ethClient.Client().CallContext(ctx, &result, "txpool_content") - if err != nil { - return nil, fmt.Errorf("failed to get tx pool content: %w", err) - } - var txs []rollkit_types.Tx - for _, accountTxs := range result.Pending { - for _, tx := range accountTxs { - txBytes, err := tx.MarshalBinary() - if err != nil { - return nil, fmt.Errorf("failed to marshal transaction: %w", err) - } - txs = append(txs, rollkit_types.Tx(txBytes)) - } - } - for _, accountTxs := range result.Queued { - for _, tx := range accountTxs { - txBytes, err := tx.MarshalBinary() - if err != nil { - return nil, fmt.Errorf("failed to marshal transaction: %w", err) - } - txs = append(txs, rollkit_types.Tx(txBytes)) - } - } - return txs, nil -} - -func (p *ProxyClient) ExecuteTxs(txs []rollkit_types.Tx, height uint64, timestamp time.Time, prevStateRoot rollkit_types.Hash) (rollkit_types.Hash, uint64, error) { - ctx := context.Background() - ethTxs := make([][]byte, len(txs)) - for i, tx := range txs { - ethTxs[i] = tx - } - prevRandao := p.derivePrevRandao(height) - var forkchoiceResult map[string]interface{} - err := p.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", - map[string]interface{}{ - "headBlockHash": common.BytesToHash(prevStateRoot[:]), - "safeBlockHash": common.BytesToHash(prevStateRoot[:]), - "finalizedBlockHash": common.BytesToHash(prevStateRoot[:]), - }, - map[string]interface{}{ - "timestamp": timestamp.Unix(), - "prevRandao": prevRandao, - "suggestedFeeRecipient": p.feeRecipient, - }, - ) - if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) - } - payloadID, ok := forkchoiceResult["payloadId"].(string) - if !ok { - return rollkit_types.Hash{}, 0, ErrNilPayloadStatus - } - var payload map[string]interface{} - err = p.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) - if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) - } - payload["transactions"] = ethTxs - var newPayloadResult map[string]interface{} - err = p.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", payload) - if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) - } - status, ok := newPayloadResult["status"].(string) - if !ok || PayloadStatus(status) != PayloadStatusValid { - return rollkit_types.Hash{}, 0, ErrInvalidPayloadStatus - } - newStateRoot := common.HexToHash(payload["stateRoot"].(string)) - gasUsed := uint64(payload["gasUsed"].(float64)) - var rollkitNewStateRoot rollkit_types.Hash - copy(rollkitNewStateRoot[:], newStateRoot[:]) - return rollkitNewStateRoot, gasUsed, nil -} - -func (p *ProxyClient) SetFinal(height uint64) error { - ctx := context.Background() - block, err := p.ethClient.BlockByNumber(ctx, big.NewInt(int64(height))) - if err != nil { - return fmt.Errorf("failed to get block at height %d: %w", height, err) - } - var result map[string]interface{} - err = p.engineClient.CallContext(ctx, &result, "engine_forkchoiceUpdatedV1", - map[string]interface{}{ - "headBlockHash": block.Hash(), - "safeBlockHash": block.Hash(), - "finalizedBlockHash": block.Hash(), - }, - nil, // No payload attributes for finalization - ) - if err != nil { - return fmt.Errorf("engine_forkchoiceUpdatedV1 failed for finalization: %w", err) - } - payloadStatus, ok := result["payloadStatus"].(map[string]interface{}) - if !ok { - return ErrNilPayloadStatus - } - status, ok := payloadStatus["status"].(string) - if !ok || PayloadStatus(status) != PayloadStatusValid { - return ErrInvalidPayloadStatus - } - return nil -} - -// derivePrevRandao generates a deterministic prevRandao value based on block height. -func (p *ProxyClient) derivePrevRandao(blockHeight uint64) common.Hash { - // TO-DO - return common.BigToHash(big.NewInt(int64(blockHeight))) -} From 2c06ad7fc445bfafb4849c0934ef7956558982ed Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Wed, 6 Nov 2024 15:47:39 -0800 Subject: [PATCH 10/43] chore: rm rollkit as a dependency --- execution.go | 2 +- execution_test.go | 2 +- go.mod | 48 +++------------ go.sum | 153 +--------------------------------------------- 4 files changed, 12 insertions(+), 193 deletions(-) diff --git a/execution.go b/execution.go index 87a2aa7..94e3bb7 100644 --- a/execution.go +++ b/execution.go @@ -13,7 +13,7 @@ import ( "github.com/ethereum/go-ethereum/rpc" execution "github.com/rollkit/go-execution" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - rollkit_types "github.com/rollkit/rollkit/types" + rollkit_types "github.com/rollkit/go-execution/types" ) type PayloadStatus string diff --git a/execution_test.go b/execution_test.go index c4b4945..4c3c407 100644 --- a/execution_test.go +++ b/execution_test.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/rollkit/go-execution/mocks" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - rollkit_types "github.com/rollkit/rollkit/types" + rollkit_types "github.com/rollkit/go-execution/types" "github.com/stretchr/testify/require" ) diff --git a/go.mod b/go.mod index d5b2fee..8ae7497 100644 --- a/go.mod +++ b/go.mod @@ -2,66 +2,48 @@ module github.com/rollkit/go-execution-evm go 1.22.8 -replace github.com/rollkit/go-execution => github.com/lastdotnet/go-execution v0.0.0-20241029045146-b7513b533b24 +replace github.com/rollkit/go-execution => github.com/lastdotnet/go-execution v0.0.0-20241106160445-7810bc1e5d3c require ( github.com/ethereum/go-ethereum v1.14.11 github.com/rollkit/go-execution v0.0.0-00010101000000-000000000000 - github.com/rollkit/rollkit v0.13.7 ) require ( github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/OneOfOne/xxhash v1.2.8 // indirect github.com/StackExchange/wmi v1.2.1 // indirect - github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect github.com/celestiaorg/go-header v0.6.2 // indirect - github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cometbft/cometbft v0.38.7 // indirect - github.com/cometbft/cometbft-db v0.8.0 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect - github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/dustin/go-humanize v1.0.1 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect - github.com/go-kit/kit v0.13.0 // indirect - github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.2.1 // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect - github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/holiman/uint256 v1.3.1 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-libp2p v0.35.0 // indirect github.com/libp2p/go-libp2p-pubsub v0.11.0 // indirect github.com/libp2p/go-msgio v0.3.0 // indirect - github.com/linxGnu/grocksdb v1.7.16 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/minio/sha256-simd v1.0.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect @@ -73,35 +55,21 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect - github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae // indirect - github.com/onsi/ginkgo v1.16.5 // indirect - github.com/onsi/gomega v1.30.0 // indirect - github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.48.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/rs/cors v1.11.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/supranational/blst v0.3.13 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect - go.etcd.io/bbolt v1.3.10 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect - golang.org/x/net v0.27.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/grpc v1.65.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect diff --git a/go.sum b/go.sum index e80ba05..22c66ad 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,11 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 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/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= -github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= 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= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= -github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -22,15 +15,11 @@ github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJR github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/celestiaorg/go-header v0.6.2 h1:qgWyJQg+/x6k4QAfN1rPt2HXHZjQOmCqD0ct4dFBIZY= github.com/celestiaorg/go-header v0.6.2/go.mod h1:Az4S4NxMOJ1eAzOaF8u5AZt5UzsSzg92uqpdXS3yOZE= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= @@ -45,25 +34,14 @@ github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwP github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= -github.com/cometbft/cometbft v0.38.7 h1:ULhIOJ9+LgSy6nLekhq9ae3juX3NnQUMMPyVdhZV6Hk= -github.com/cometbft/cometbft v0.38.7/go.mod h1:HIyf811dFMI73IE0F7RrnY/Fr+d1+HuJAgtkEpQjCMY= -github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= -github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= @@ -82,19 +60,8 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5il github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= -github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= -github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= @@ -105,28 +72,17 @@ github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= -github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= -github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= @@ -137,28 +93,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= -github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= @@ -174,17 +110,14 @@ github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpx github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= @@ -193,11 +126,8 @@ github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7Bd github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= @@ -213,8 +143,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lastdotnet/go-execution v0.0.0-20241029045146-b7513b533b24 h1:F/XQxFKbZA1w8daNqHdh/8waKQfWLAyZTmkQVVxlgVk= -github.com/lastdotnet/go-execution v0.0.0-20241029045146-b7513b533b24/go.mod h1:fo+uH57fdmebAEYEVtLhsSJ7Jw8CKRSydCnyqJZRBAA= +github.com/lastdotnet/go-execution v0.0.0-20241106160445-7810bc1e5d3c h1:A8/nKchjQ5waN5PEwVNsTaAdTm2iukmjRlcLcrwunjA= +github.com/lastdotnet/go-execution v0.0.0-20241106160445-7810bc1e5d3c/go.mod h1:WgzV+v1zOka30IQbuE9Rmk7xkfF3xhCmptpit2v5Zo0= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -239,9 +169,6 @@ github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQsc github.com/libp2p/go-reuseport v0.4.0/go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8Se6DrI2E1cLU= github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ= github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= -github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8= -github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -261,8 +188,6 @@ github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8Rv github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= @@ -295,33 +220,14 @@ github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= -github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= -github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae h1:FatpGJD2jmJfhZiFDElaC0QhZUDQnxUeAwTGkfAHN3I= -github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk= github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pion/datachannel v1.5.6 h1:1IxKJntfSlYkpUj8LlYRSWpYiTTC02nUrOE8T3DqGeg= github.com/pion/datachannel v1.5.6/go.mod h1:1eKT6Q85pRnr2mHiWHxJwO50SfZRtWHTsNIVb/NfGW4= github.com/pion/dtls/v2 v2.2.11 h1:9U/dpCYl1ySttROPWJgqWKEylUdT0fXp/xst6JwY5Ks= @@ -380,36 +286,20 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/rollkit/rollkit v0.13.7 h1:GNWX0tPs02DsLeTc0z8G7rO5PDR0yavT08Umr7O02Ks= -github.com/rollkit/rollkit v0.13.7/go.mod h1:clM4aPsWDJk/IN/SqCBsA+ab0/8gdh+5O4hRkLWKB7s= github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= @@ -423,17 +313,13 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= -go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= @@ -450,7 +336,6 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8 go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -465,43 +350,28 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -511,7 +381,6 @@ golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= @@ -521,7 +390,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= @@ -530,32 +398,15 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 50b32f0490518424638d159171f3925d3aafee36 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Wed, 6 Nov 2024 18:05:45 -0800 Subject: [PATCH 11/43] chore: refine client implementation and tests --- execution.go | 39 ++--- execution_test.go | 359 +++++++++++++++++++++++++++++++++------------- 2 files changed, 281 insertions(+), 117 deletions(-) diff --git a/execution.go b/execution.go index 94e3bb7..8bf431f 100644 --- a/execution.go +++ b/execution.go @@ -163,9 +163,27 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(txs []rollkit_types.Tx, height uin ethTxs[i] = tx } - prevRandao := c.derivePrevRandao(height) + // 1. First call engine_newPayloadV1 with the transactions + var newPayloadResult map[string]interface{} + err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", map[string]interface{}{ + "parentHash": common.BytesToHash(prevStateRoot[:]), + "timestamp": timestamp.Unix(), + "prevRandao": c.derivePrevRandao(height), + "feeRecipient": c.feeRecipient, + "transactions": ethTxs, + }) + if err != nil { + return rollkit_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) + } + + status, ok := newPayloadResult["status"].(string) + if !ok || PayloadStatus(status) != PayloadStatusValid { + return rollkit_types.Hash{}, 0, ErrInvalidPayloadStatus + } + + // 2. Then update fork choice var forkchoiceResult map[string]interface{} - err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", map[string]interface{}{ "headBlockHash": common.BytesToHash(prevStateRoot[:]), "safeBlockHash": common.BytesToHash(prevStateRoot[:]), @@ -173,7 +191,7 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(txs []rollkit_types.Tx, height uin }, map[string]interface{}{ "timestamp": timestamp.Unix(), - "prevRandao": prevRandao, + "prevRandao": c.derivePrevRandao(height), "suggestedFeeRecipient": c.feeRecipient, }, ) @@ -181,29 +199,18 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(txs []rollkit_types.Tx, height uin return rollkit_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) } + // 3. Get the execution results + var payload map[string]interface{} payloadID, ok := forkchoiceResult["payloadId"].(string) if !ok { return rollkit_types.Hash{}, 0, ErrNilPayloadStatus } - var payload map[string]interface{} err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) if err != nil { return rollkit_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) } - payload["transactions"] = ethTxs - var newPayloadResult map[string]interface{} - err = c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", payload) - if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) - } - - status, ok := newPayloadResult["status"].(string) - if !ok || PayloadStatus(status) != PayloadStatusValid { - return rollkit_types.Hash{}, 0, ErrInvalidPayloadStatus - } - newStateRoot := common.HexToHash(payload["stateRoot"].(string)) gasUsed := uint64(payload["gasUsed"].(float64)) var rollkitNewStateRoot rollkit_types.Hash diff --git a/execution_test.go b/execution_test.go index 4c3c407..7a49e94 100644 --- a/execution_test.go +++ b/execution_test.go @@ -1,157 +1,314 @@ package execution import ( + "encoding/json" + "fmt" + "io" + "net/http" "net/http/httptest" - "os" "testing" "time" "github.com/ethereum/go-ethereum/common" - "github.com/rollkit/go-execution/mocks" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" rollkit_types "github.com/rollkit/go-execution/types" "github.com/stretchr/testify/require" ) -const ( - jwtSecretFile = "jwt.hex" -) - -type testEnv struct { - server *httptest.Server - jwtSecret string - cleanup func() - client *EngineAPIExecutionClient - proxyConf *proxy_json_rpc.Config - mockExec *mocks.MockExecute +type mockEngineAPI struct { + *httptest.Server } -func setupTestEnv(t *testing.T) *testEnv { +func newMockEngineAPI(t *testing.T) *mockEngineAPI { t.Helper() - tmpDir, err := os.MkdirTemp("", "execution-test-*") - require.NoError(t, err) - - cleanup := func() { - os.RemoveAll(tmpDir) - } - - // setup a proxy config - proxyConf := &proxy_json_rpc.Config{ - DefaultTimeout: 5 * time.Second, - MaxRequestSize: 1024 * 1024, - } - - // create a mock execute from mocks package - mockExec := mocks.NewMockExecute(t) - - // create a proxy server with mock execute - server := proxy_json_rpc.NewServer(mockExec, proxyConf) - testServer := httptest.NewServer(server) - - // create a proxy client that implements the Execute interface - ethURL := "http://localhost:8545" - engineURL := "http://localhost:8551" - genesisHash := common.HexToHash("0x0") - feeRecipient := common.HexToAddress("0x0") + mock := &mockEngineAPI{} + mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var resp map[string]interface{} + + body, err := io.ReadAll(r.Body) + require.NoError(t, err) + + var req map[string]interface{} + err = json.Unmarshal(body, &req) + require.NoError(t, err) + + method := req["method"].(string) + switch method { + case "engine_newPayloadV1": + resp = map[string]interface{}{ + "status": "VALID", + "latestValidHash": "0x1234", + } + case "engine_forkchoiceUpdatedV1": + resp = map[string]interface{}{ + "payloadStatus": map[string]interface{}{ + "status": "VALID", + }, + "payloadId": "0x1234", + } + case "engine_getPayloadV1": + resp = map[string]interface{}{ + "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "gasUsed": float64(21000), + "gasLimit": float64(1000000), + } + } + + json.NewEncoder(w).Encode(map[string]interface{}{ + "jsonrpc": "2.0", + "id": req["id"], + "result": resp, + }) + })) + + return mock +} - client, err := NewEngineAPIExecutionClient(proxyConf, ethURL, engineURL, genesisHash, feeRecipient) - require.NoError(t, err) +type mockEthAPI struct { + *httptest.Server +} - err = client.Start(testServer.URL) - require.NoError(t, err) +func newMockEthAPI(t *testing.T) *mockEthAPI { + t.Helper() - return &testEnv{ - server: testServer, - jwtSecret: "", - cleanup: func() { - cleanup() - testServer.Close() - client.Stop() - }, - client: client, - proxyConf: proxyConf, - mockExec: mockExec, - } + mock := &mockEthAPI{} + mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var resp interface{} + + body, err := io.ReadAll(r.Body) + require.NoError(t, err) + + var req map[string]interface{} + err = json.Unmarshal(body, &req) + require.NoError(t, err) + + method := req["method"].(string) + switch method { + case "txpool_content": + resp = map[string]interface{}{ + "pending": map[string]interface{}{ + "0x1234567890123456789012345678901234567890": map[string]interface{}{ + "0": map[string]interface{}{ + "input": "0x123456", + "nonce": "0x0", + "from": "0x1234567890123456789012345678901234567890", + "to": "0x0987654321098765432109876543210987654321", + "value": "0x0", + "gas": "0x5208", + "gasPrice": "0x3b9aca00", + "chainId": "0x1", + "v": "0x1b", + "r": "0x1234", + "s": "0x5678", + "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", + "type": "0x0", + }, + }, + }, + "queued": map[string]interface{}{}, + } + case "eth_getBlockByNumber", "eth_blockByNumber": + params := req["params"].([]interface{}) + blockNumRaw := params[0] + fullTx := false + if len(params) > 1 { + fullTx = params[1].(bool) + } + + var blockNum string + switch v := blockNumRaw.(type) { + case string: + blockNum = v + case float64: + blockNum = fmt.Sprintf("0x%x", int64(v)) + } + + if blockNum == "0x1" { + emptyBlockHash := "0x0000000000000000000000000000000000000000000000000000000000000000" + blockResp := map[string]interface{}{ + "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", + "number": "0x1", + "parentHash": emptyBlockHash, + "timestamp": "0x0", + "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "receiptsRoot": emptyBlockHash, + "transactionsRoot": emptyBlockHash, + "sha3Uncles": emptyBlockHash, + "logsBloom": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "difficulty": "0x0", + "totalDifficulty": "0x0", + "size": "0x0", + "gasLimit": "0x1000000", + "gasUsed": "0x0", + "miner": "0x0000000000000000000000000000000000000000", + "extraData": "0x", + "mixHash": emptyBlockHash, + "nonce": "0x0000000000000000", + "baseFeePerGas": "0x0", + "uncles": []interface{}{}, + } + + if fullTx { + blockResp["transactions"] = []interface{}{} + } else { + blockResp["transactions"] = []interface{}{} + } + + resp = blockResp + } + t.Logf("Requested block number: %s, Matching: %v", blockNum, blockNum == "0x1") + } + + t.Logf("Request: %s, Params: %v", method, req["params"]) + t.Logf("Response: %v", resp) + + json.NewEncoder(w).Encode(map[string]interface{}{ + "jsonrpc": "2.0", + "id": req["id"], + "result": resp, + }) + })) + + return mock } func TestEngineAPIExecutionClient_InitChain(t *testing.T) { - env := setupTestEnv(t) - defer env.cleanup() + mockEngine := newMockEngineAPI(t) + defer mockEngine.Close() + + mockEth := newMockEthAPI(t) + defer mockEth.Close() + + client, err := NewEngineAPIExecutionClient( + &proxy_json_rpc.Config{}, + mockEth.URL, + mockEngine.URL, + common.Hash{}, + common.Address{}, + ) + require.NoError(t, err) genesisTime := time.Now().UTC().Truncate(time.Second) initialHeight := uint64(0) chainID := "11155111" // sepolia chain id - expectedStateRoot := rollkit_types.Hash{} - copy(expectedStateRoot[:], []byte{1, 2, 3}) - expectedGasLimit := uint64(1000000) + stateRoot, gasLimit, err := client.InitChain(genesisTime, initialHeight, chainID) + require.NoError(t, err) - env.mockExec.On("InitChain", genesisTime, initialHeight, chainID). - Return(expectedStateRoot, expectedGasLimit, nil) + mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") + var expectedStateRoot rollkit_types.Hash + copy(expectedStateRoot[:], mockStateRoot.Bytes()) - stateRoot, gasLimit, err := env.client.InitChain(genesisTime, initialHeight, chainID) - require.NoError(t, err) require.Equal(t, expectedStateRoot, stateRoot) - require.Equal(t, expectedGasLimit, gasLimit) - - env.mockExec.AssertExpectations(t) + require.Equal(t, uint64(1000000), gasLimit) } func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { - env := setupTestEnv(t) - defer env.cleanup() - - expectedTxs := []rollkit_types.Tx{[]byte("tx1"), []byte("tx2")} - env.mockExec.On("GetTxs").Return(expectedTxs, nil) + mockEngine := newMockEngineAPI(t) + defer mockEngine.Close() + + mockEth := newMockEthAPI(t) + defer mockEth.Close() + + client, err := NewEngineAPIExecutionClient( + &proxy_json_rpc.Config{}, + mockEth.URL, + mockEngine.URL, + common.Hash{}, + common.Address{}, + ) - txs, err := env.client.GetTxs() require.NoError(t, err) - require.Equal(t, expectedTxs, txs) - - env.mockExec.AssertExpectations(t) + mockEth.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var resp interface{} + + body, err := io.ReadAll(r.Body) + require.NoError(t, err) + + var req map[string]interface{} + err = json.Unmarshal(body, &req) + require.NoError(t, err) + + method := req["method"].(string) + if method == "txpool_content" { + resp = map[string]interface{}{ + "pending": map[string]interface{}{ + "0x1234567890123456789012345678901234567890": map[string]interface{}{ + "0": map[string]interface{}{ + "input": "0x123456", + "nonce": "0x0", + "from": "0x1234567890123456789012345678901234567890", + "to": "0x0987654321098765432109876543210987654321", + "value": "0x0", + "gas": "0x5208", + "gasPrice": "0x3b9aca00", + "chainId": "0x1", + "v": "0x1b", + "r": "0x1234", + "s": "0x5678", + "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", + "type": "0x0", + }, + }, + }, + "queued": map[string]interface{}{}, + } + } + + json.NewEncoder(w).Encode(map[string]interface{}{ + "jsonrpc": "2.0", + "id": req["id"], + "result": resp, + }) + })) + + txs, err := client.GetTxs() + require.NoError(t, err) + require.NotEmpty(t, txs) + require.Greater(t, len(txs), 0) } func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { - env := setupTestEnv(t) - defer env.cleanup() + mockEngine := newMockEngineAPI(t) + defer mockEngine.Close() + + mockEth := newMockEthAPI(t) + defer mockEth.Close() + + client, err := NewEngineAPIExecutionClient( + &proxy_json_rpc.Config{}, + mockEth.URL, + mockEngine.URL, + common.Hash{}, + common.Address{}, + ) + require.NoError(t, err) blockHeight := uint64(1) timestamp := time.Now().UTC().Truncate(time.Second) - prevStateRoot := rollkit_types.Hash{} - copy(prevStateRoot[:], []byte{1, 2, 3}) - testTx := rollkit_types.Tx("test transaction") - expectedStateRoot := rollkit_types.Hash{} - copy(expectedStateRoot[:], []byte{4, 5, 6}) - expectedGasUsed := uint64(21000) + var prevStateRoot rollkit_types.Hash + copy(prevStateRoot[:], []byte{1, 2, 3}) - env.mockExec.On("ExecuteTxs", []rollkit_types.Tx{testTx}, blockHeight, timestamp, prevStateRoot). - Return(expectedStateRoot, expectedGasUsed, nil) + testTx := rollkit_types.Tx("test transaction") - stateRoot, gasUsed, err := env.client.ExecuteTxs( + stateRoot, gasUsed, err := client.ExecuteTxs( []rollkit_types.Tx{testTx}, blockHeight, timestamp, prevStateRoot, ) require.NoError(t, err) - require.Equal(t, expectedStateRoot, stateRoot) - require.Equal(t, expectedGasUsed, gasUsed) - env.mockExec.AssertExpectations(t) + mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") + var expectedStateRoot rollkit_types.Hash + copy(expectedStateRoot[:], mockStateRoot.Bytes()) + + require.Equal(t, expectedStateRoot, stateRoot) + require.Equal(t, uint64(21000), gasUsed) } func TestEngineAPIExecutionClient_SetFinal(t *testing.T) { - env := setupTestEnv(t) - defer env.cleanup() - - blockHeight := uint64(1) - - env.mockExec.On("SetFinal", blockHeight).Return(nil) - - err := env.client.SetFinal(blockHeight) - require.NoError(t, err) - - env.mockExec.AssertExpectations(t) + // TO-DO } From 8020a0306ddd0071645d99c41ca0f95cbf6873f8 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Thu, 7 Nov 2024 16:02:04 -0800 Subject: [PATCH 12/43] chore: update execution api interface name --- execution.go | 2 +- go.mod | 9 ++++----- go.sum | 24 ++++++++++++------------ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/execution.go b/execution.go index 8bf431f..564534c 100644 --- a/execution.go +++ b/execution.go @@ -30,7 +30,7 @@ var ( ) // Ensure EngineAPIExecutionClient implements the execution.Execute interface -var _ execution.Execute = (*EngineAPIExecutionClient)(nil) +var _ execution.Executor = (*EngineAPIExecutionClient)(nil) // EngineAPIExecutionClient implements the execution.Execute interface type EngineAPIExecutionClient struct { diff --git a/go.mod b/go.mod index 8ae7497..889cb94 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/rollkit/go-execution-evm go 1.22.8 -replace github.com/rollkit/go-execution => github.com/lastdotnet/go-execution v0.0.0-20241106160445-7810bc1e5d3c +replace github.com/rollkit/go-execution => github.com/lastdotnet/go-execution v0.0.0-20241107213138-d1712b8c4d58 require ( github.com/ethereum/go-ethereum v1.14.11 @@ -15,7 +15,7 @@ require ( github.com/bits-and-blooms/bitset v1.13.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect - github.com/celestiaorg/go-header v0.6.2 // indirect + github.com/celestiaorg/go-header v0.6.3 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect @@ -59,16 +59,15 @@ require ( github.com/rs/cors v1.11.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/stretchr/objx v0.5.2 // indirect github.com/supranational/blst v0.3.13 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.25.0 // indirect + golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.22.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 22c66ad..1682f35 100644 --- a/go.sum +++ b/go.sum @@ -17,8 +17,8 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurT github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/celestiaorg/go-header v0.6.2 h1:qgWyJQg+/x6k4QAfN1rPt2HXHZjQOmCqD0ct4dFBIZY= -github.com/celestiaorg/go-header v0.6.2/go.mod h1:Az4S4NxMOJ1eAzOaF8u5AZt5UzsSzg92uqpdXS3yOZE= +github.com/celestiaorg/go-header v0.6.3 h1:VI+fsNxFLeUS7cNn0LgHP6Db66uslnKp/fgMg5nxqHg= +github.com/celestiaorg/go-header v0.6.3/go.mod h1:Az4S4NxMOJ1eAzOaF8u5AZt5UzsSzg92uqpdXS3yOZE= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -143,8 +143,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lastdotnet/go-execution v0.0.0-20241106160445-7810bc1e5d3c h1:A8/nKchjQ5waN5PEwVNsTaAdTm2iukmjRlcLcrwunjA= -github.com/lastdotnet/go-execution v0.0.0-20241106160445-7810bc1e5d3c/go.mod h1:WgzV+v1zOka30IQbuE9Rmk7xkfF3xhCmptpit2v5Zo0= +github.com/lastdotnet/go-execution v0.0.0-20241107213138-d1712b8c4d58 h1:sjinTQV5doakYIhNFcDUzcfdmJzdIhKvdZuXo+z2+Jc= +github.com/lastdotnet/go-execution v0.0.0-20241107213138-d1712b8c4d58/go.mod h1:JYUo1RXqdVQjuOFhU8oO6g7pKOk29ZFsdizMXkHwVdA= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -340,8 +340,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -356,8 +356,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -377,13 +377,13 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 037d5ae00d153794b6f98f4691cf515e55edb642 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Thu, 7 Nov 2024 16:07:18 -0800 Subject: [PATCH 13/43] chore: renaming go-execution types import path --- execution.go | 34 +++++++++++++++++----------------- execution_test.go | 12 ++++++------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/execution.go b/execution.go index 564534c..84cc78d 100644 --- a/execution.go +++ b/execution.go @@ -13,7 +13,7 @@ import ( "github.com/ethereum/go-ethereum/rpc" execution "github.com/rollkit/go-execution" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - rollkit_types "github.com/rollkit/go-execution/types" + go_execution_types "github.com/rollkit/go-execution/types" ) type PayloadStatus string @@ -84,7 +84,7 @@ func (c *EngineAPIExecutionClient) Stop() { } // InitChain initializes the blockchain with genesis information -func (c *EngineAPIExecutionClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (rollkit_types.Hash, uint64, error) { +func (c *EngineAPIExecutionClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (go_execution_types.Hash, uint64, error) { ctx := context.Background() var forkchoiceResult map[string]interface{} err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", @@ -100,29 +100,29 @@ func (c *EngineAPIExecutionClient) InitChain(genesisTime time.Time, initialHeigh }, ) if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + return go_execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) } payloadID, ok := forkchoiceResult["payloadId"].(string) if !ok { - return rollkit_types.Hash{}, 0, ErrNilPayloadStatus + return go_execution_types.Hash{}, 0, ErrNilPayloadStatus } var payload map[string]interface{} err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + return go_execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) } stateRoot := common.HexToHash(payload["stateRoot"].(string)) gasLimit := uint64(payload["gasLimit"].(float64)) - var rollkitStateRoot rollkit_types.Hash + var rollkitStateRoot go_execution_types.Hash copy(rollkitStateRoot[:], stateRoot[:]) return rollkitStateRoot, gasLimit, nil } // GetTxs retrieves transactions from the transaction pool -func (c *EngineAPIExecutionClient) GetTxs() ([]rollkit_types.Tx, error) { +func (c *EngineAPIExecutionClient) GetTxs() ([]go_execution_types.Tx, error) { ctx := context.Background() var result struct { Pending map[string]map[string]*types.Transaction `json:"pending"` @@ -133,14 +133,14 @@ func (c *EngineAPIExecutionClient) GetTxs() ([]rollkit_types.Tx, error) { return nil, fmt.Errorf("failed to get tx pool content: %w", err) } - var txs []rollkit_types.Tx + var txs []go_execution_types.Tx for _, accountTxs := range result.Pending { for _, tx := range accountTxs { txBytes, err := tx.MarshalBinary() if err != nil { return nil, fmt.Errorf("failed to marshal transaction: %w", err) } - txs = append(txs, rollkit_types.Tx(txBytes)) + txs = append(txs, go_execution_types.Tx(txBytes)) } } for _, accountTxs := range result.Queued { @@ -149,14 +149,14 @@ func (c *EngineAPIExecutionClient) GetTxs() ([]rollkit_types.Tx, error) { if err != nil { return nil, fmt.Errorf("failed to marshal transaction: %w", err) } - txs = append(txs, rollkit_types.Tx(txBytes)) + txs = append(txs, go_execution_types.Tx(txBytes)) } } return txs, nil } // ExecuteTxs executes the given transactions and returns the new state root and gas used -func (c *EngineAPIExecutionClient) ExecuteTxs(txs []rollkit_types.Tx, height uint64, timestamp time.Time, prevStateRoot rollkit_types.Hash) (rollkit_types.Hash, uint64, error) { +func (c *EngineAPIExecutionClient) ExecuteTxs(txs []go_execution_types.Tx, height uint64, timestamp time.Time, prevStateRoot go_execution_types.Hash) (go_execution_types.Hash, uint64, error) { ctx := context.Background() ethTxs := make([][]byte, len(txs)) for i, tx := range txs { @@ -173,12 +173,12 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(txs []rollkit_types.Tx, height uin "transactions": ethTxs, }) if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) + return go_execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) } status, ok := newPayloadResult["status"].(string) if !ok || PayloadStatus(status) != PayloadStatusValid { - return rollkit_types.Hash{}, 0, ErrInvalidPayloadStatus + return go_execution_types.Hash{}, 0, ErrInvalidPayloadStatus } // 2. Then update fork choice @@ -196,24 +196,24 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(txs []rollkit_types.Tx, height uin }, ) if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + return go_execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) } // 3. Get the execution results var payload map[string]interface{} payloadID, ok := forkchoiceResult["payloadId"].(string) if !ok { - return rollkit_types.Hash{}, 0, ErrNilPayloadStatus + return go_execution_types.Hash{}, 0, ErrNilPayloadStatus } err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) if err != nil { - return rollkit_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + return go_execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) } newStateRoot := common.HexToHash(payload["stateRoot"].(string)) gasUsed := uint64(payload["gasUsed"].(float64)) - var rollkitNewStateRoot rollkit_types.Hash + var rollkitNewStateRoot go_execution_types.Hash copy(rollkitNewStateRoot[:], newStateRoot[:]) return rollkitNewStateRoot, gasUsed, nil } diff --git a/execution_test.go b/execution_test.go index 7a49e94..c69a1ef 100644 --- a/execution_test.go +++ b/execution_test.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - rollkit_types "github.com/rollkit/go-execution/types" + go_execution_types "github.com/rollkit/go-execution/types" "github.com/stretchr/testify/require" ) @@ -197,7 +197,7 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { require.NoError(t, err) mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") - var expectedStateRoot rollkit_types.Hash + var expectedStateRoot go_execution_types.Hash copy(expectedStateRoot[:], mockStateRoot.Bytes()) require.Equal(t, expectedStateRoot, stateRoot) @@ -288,13 +288,13 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { blockHeight := uint64(1) timestamp := time.Now().UTC().Truncate(time.Second) - var prevStateRoot rollkit_types.Hash + var prevStateRoot go_execution_types.Hash copy(prevStateRoot[:], []byte{1, 2, 3}) - testTx := rollkit_types.Tx("test transaction") + testTx := go_execution_types.Tx("test transaction") stateRoot, gasUsed, err := client.ExecuteTxs( - []rollkit_types.Tx{testTx}, + []go_execution_types.Tx{testTx}, blockHeight, timestamp, prevStateRoot, @@ -302,7 +302,7 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { require.NoError(t, err) mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") - var expectedStateRoot rollkit_types.Hash + var expectedStateRoot go_execution_types.Hash copy(expectedStateRoot[:], mockStateRoot.Bytes()) require.Equal(t, expectedStateRoot, stateRoot) From e73997558659313f01461762c28a5834e732b584 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Thu, 7 Nov 2024 18:06:21 -0800 Subject: [PATCH 14/43] refactor: move mocks to its own pkg --- execution.go | 84 +++++++++++---------- execution_test.go | 184 ++++------------------------------------------ go.mod | 1 + mocks/mocks.go | 166 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 226 insertions(+), 209 deletions(-) create mode 100644 mocks/mocks.go diff --git a/execution.go b/execution.go index 84cc78d..e90286e 100644 --- a/execution.go +++ b/execution.go @@ -13,7 +13,7 @@ import ( "github.com/ethereum/go-ethereum/rpc" execution "github.com/rollkit/go-execution" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - go_execution_types "github.com/rollkit/go-execution/types" + execution_types "github.com/rollkit/go-execution/types" ) type PayloadStatus string @@ -34,7 +34,7 @@ var _ execution.Executor = (*EngineAPIExecutionClient)(nil) // EngineAPIExecutionClient implements the execution.Execute interface type EngineAPIExecutionClient struct { - client *proxy_json_rpc.Client + proxyClient *proxy_json_rpc.Client engineClient *rpc.Client // engine api ethClient *ethclient.Client genesisHash common.Hash @@ -42,9 +42,9 @@ type EngineAPIExecutionClient struct { } // NewEngineAPIExecutionClient creates a new instance of EngineAPIExecutionClient -func NewEngineAPIExecutionClient(config *proxy_json_rpc.Config, ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { - client := proxy_json_rpc.NewClient() - client.SetConfig(config) +func NewEngineAPIExecutionClient(proxyConfig *proxy_json_rpc.Config, ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { + proxyClient := proxy_json_rpc.NewClient() + proxyClient.SetConfig(proxyConfig) ethClient, err := ethclient.Dial(ethURL) if err != nil { @@ -57,7 +57,7 @@ func NewEngineAPIExecutionClient(config *proxy_json_rpc.Config, ethURL, engineUR } return &EngineAPIExecutionClient{ - client: client, + proxyClient: proxyClient, engineClient: engineClient, ethClient: ethClient, genesisHash: genesisHash, @@ -67,12 +67,12 @@ func NewEngineAPIExecutionClient(config *proxy_json_rpc.Config, ethURL, engineUR // Start starts the execution client func (c *EngineAPIExecutionClient) Start(url string) error { - return c.client.Start(url) + return c.proxyClient.Start(url) } // Stop stops the execution client and closes all connections func (c *EngineAPIExecutionClient) Stop() { - c.client.Stop() + c.proxyClient.Stop() if c.engineClient != nil { c.engineClient.Close() @@ -84,8 +84,9 @@ func (c *EngineAPIExecutionClient) Stop() { } // InitChain initializes the blockchain with genesis information -func (c *EngineAPIExecutionClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (go_execution_types.Hash, uint64, error) { +func (c *EngineAPIExecutionClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (execution_types.Hash, uint64, error) { ctx := context.Background() + var forkchoiceResult map[string]interface{} err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", map[string]interface{}{ @@ -100,30 +101,31 @@ func (c *EngineAPIExecutionClient) InitChain(genesisTime time.Time, initialHeigh }, ) if err != nil { - return go_execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) } payloadID, ok := forkchoiceResult["payloadId"].(string) if !ok { - return go_execution_types.Hash{}, 0, ErrNilPayloadStatus + return execution_types.Hash{}, 0, ErrNilPayloadStatus } - var payload map[string]interface{} - err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) + var payloadResult map[string]interface{} + err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV1", payloadID) if err != nil { - return go_execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) } - stateRoot := common.HexToHash(payload["stateRoot"].(string)) - gasLimit := uint64(payload["gasLimit"].(float64)) - var rollkitStateRoot go_execution_types.Hash + stateRoot := common.HexToHash(payloadResult["stateRoot"].(string)) + gasLimit := uint64(payloadResult["gasLimit"].(float64)) + var rollkitStateRoot execution_types.Hash copy(rollkitStateRoot[:], stateRoot[:]) return rollkitStateRoot, gasLimit, nil } // GetTxs retrieves transactions from the transaction pool -func (c *EngineAPIExecutionClient) GetTxs() ([]go_execution_types.Tx, error) { +func (c *EngineAPIExecutionClient) GetTxs() ([]execution_types.Tx, error) { ctx := context.Background() + var result struct { Pending map[string]map[string]*types.Transaction `json:"pending"` Queued map[string]map[string]*types.Transaction `json:"queued"` @@ -133,37 +135,42 @@ func (c *EngineAPIExecutionClient) GetTxs() ([]go_execution_types.Tx, error) { return nil, fmt.Errorf("failed to get tx pool content: %w", err) } - var txs []go_execution_types.Tx + var txs []execution_types.Tx + + // add pending txs for _, accountTxs := range result.Pending { for _, tx := range accountTxs { txBytes, err := tx.MarshalBinary() if err != nil { return nil, fmt.Errorf("failed to marshal transaction: %w", err) } - txs = append(txs, go_execution_types.Tx(txBytes)) + txs = append(txs, execution_types.Tx(txBytes)) } } + + // add queued txs for _, accountTxs := range result.Queued { for _, tx := range accountTxs { txBytes, err := tx.MarshalBinary() if err != nil { return nil, fmt.Errorf("failed to marshal transaction: %w", err) } - txs = append(txs, go_execution_types.Tx(txBytes)) + txs = append(txs, execution_types.Tx(txBytes)) } } return txs, nil } // ExecuteTxs executes the given transactions and returns the new state root and gas used -func (c *EngineAPIExecutionClient) ExecuteTxs(txs []go_execution_types.Tx, height uint64, timestamp time.Time, prevStateRoot go_execution_types.Hash) (go_execution_types.Hash, uint64, error) { +func (c *EngineAPIExecutionClient) ExecuteTxs(txs []execution_types.Tx, height uint64, timestamp time.Time, prevStateRoot execution_types.Hash) (execution_types.Hash, uint64, error) { ctx := context.Background() + ethTxs := make([][]byte, len(txs)) for i, tx := range txs { ethTxs[i] = tx } - // 1. First call engine_newPayloadV1 with the transactions + // call engine_newPayloadV1 with the txs var newPayloadResult map[string]interface{} err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", map[string]interface{}{ "parentHash": common.BytesToHash(prevStateRoot[:]), @@ -173,15 +180,15 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(txs []go_execution_types.Tx, heigh "transactions": ethTxs, }) if err != nil { - return go_execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) } status, ok := newPayloadResult["status"].(string) if !ok || PayloadStatus(status) != PayloadStatusValid { - return go_execution_types.Hash{}, 0, ErrInvalidPayloadStatus + return execution_types.Hash{}, 0, ErrInvalidPayloadStatus } - // 2. Then update fork choice + // update fork choice var forkchoiceResult map[string]interface{} err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", map[string]interface{}{ @@ -196,24 +203,24 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(txs []go_execution_types.Tx, heigh }, ) if err != nil { - return go_execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) } - // 3. Get the execution results - var payload map[string]interface{} + // get the execution results + var payloadResult map[string]interface{} payloadID, ok := forkchoiceResult["payloadId"].(string) if !ok { - return go_execution_types.Hash{}, 0, ErrNilPayloadStatus + return execution_types.Hash{}, 0, ErrNilPayloadStatus } - err = c.engineClient.CallContext(ctx, &payload, "engine_getPayloadV1", payloadID) + err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV1", payloadID) if err != nil { - return go_execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) } - newStateRoot := common.HexToHash(payload["stateRoot"].(string)) - gasUsed := uint64(payload["gasUsed"].(float64)) - var rollkitNewStateRoot go_execution_types.Hash + newStateRoot := common.HexToHash(payloadResult["stateRoot"].(string)) + gasUsed := uint64(payloadResult["gasUsed"].(float64)) + var rollkitNewStateRoot execution_types.Hash copy(rollkitNewStateRoot[:], newStateRoot[:]) return rollkitNewStateRoot, gasUsed, nil } @@ -221,13 +228,14 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(txs []go_execution_types.Tx, heigh // SetFinal marks a block at the given height as final func (c *EngineAPIExecutionClient) SetFinal(height uint64) error { ctx := context.Background() + block, err := c.ethClient.BlockByNumber(ctx, big.NewInt(int64(height))) if err != nil { return fmt.Errorf("failed to get block at height %d: %w", height, err) } - var result map[string]interface{} - err = c.engineClient.CallContext(ctx, &result, "engine_forkchoiceUpdatedV1", + var forkchoiceResult map[string]interface{} + err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", map[string]interface{}{ "headBlockHash": block.Hash(), "safeBlockHash": block.Hash(), @@ -239,7 +247,7 @@ func (c *EngineAPIExecutionClient) SetFinal(height uint64) error { return fmt.Errorf("engine_forkchoiceUpdatedV1 failed for finalization: %w", err) } - payloadStatus, ok := result["payloadStatus"].(map[string]interface{}) + payloadStatus, ok := forkchoiceResult["payloadStatus"].(map[string]interface{}) if !ok { return ErrNilPayloadStatus } diff --git a/execution_test.go b/execution_test.go index c69a1ef..a8b9baa 100644 --- a/execution_test.go +++ b/execution_test.go @@ -2,7 +2,6 @@ package execution import ( "encoding/json" - "fmt" "io" "net/http" "net/http/httptest" @@ -10,174 +9,17 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/rollkit/go-execution-evm/mocks" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - go_execution_types "github.com/rollkit/go-execution/types" + execution_types "github.com/rollkit/go-execution/types" "github.com/stretchr/testify/require" ) -type mockEngineAPI struct { - *httptest.Server -} - -func newMockEngineAPI(t *testing.T) *mockEngineAPI { - t.Helper() - - mock := &mockEngineAPI{} - mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - var resp map[string]interface{} - - body, err := io.ReadAll(r.Body) - require.NoError(t, err) - - var req map[string]interface{} - err = json.Unmarshal(body, &req) - require.NoError(t, err) - - method := req["method"].(string) - switch method { - case "engine_newPayloadV1": - resp = map[string]interface{}{ - "status": "VALID", - "latestValidHash": "0x1234", - } - case "engine_forkchoiceUpdatedV1": - resp = map[string]interface{}{ - "payloadStatus": map[string]interface{}{ - "status": "VALID", - }, - "payloadId": "0x1234", - } - case "engine_getPayloadV1": - resp = map[string]interface{}{ - "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", - "gasUsed": float64(21000), - "gasLimit": float64(1000000), - } - } - - json.NewEncoder(w).Encode(map[string]interface{}{ - "jsonrpc": "2.0", - "id": req["id"], - "result": resp, - }) - })) - - return mock -} - -type mockEthAPI struct { - *httptest.Server -} - -func newMockEthAPI(t *testing.T) *mockEthAPI { - t.Helper() - - mock := &mockEthAPI{} - mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - var resp interface{} - - body, err := io.ReadAll(r.Body) - require.NoError(t, err) - - var req map[string]interface{} - err = json.Unmarshal(body, &req) - require.NoError(t, err) - - method := req["method"].(string) - switch method { - case "txpool_content": - resp = map[string]interface{}{ - "pending": map[string]interface{}{ - "0x1234567890123456789012345678901234567890": map[string]interface{}{ - "0": map[string]interface{}{ - "input": "0x123456", - "nonce": "0x0", - "from": "0x1234567890123456789012345678901234567890", - "to": "0x0987654321098765432109876543210987654321", - "value": "0x0", - "gas": "0x5208", - "gasPrice": "0x3b9aca00", - "chainId": "0x1", - "v": "0x1b", - "r": "0x1234", - "s": "0x5678", - "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", - "type": "0x0", - }, - }, - }, - "queued": map[string]interface{}{}, - } - case "eth_getBlockByNumber", "eth_blockByNumber": - params := req["params"].([]interface{}) - blockNumRaw := params[0] - fullTx := false - if len(params) > 1 { - fullTx = params[1].(bool) - } - - var blockNum string - switch v := blockNumRaw.(type) { - case string: - blockNum = v - case float64: - blockNum = fmt.Sprintf("0x%x", int64(v)) - } - - if blockNum == "0x1" { - emptyBlockHash := "0x0000000000000000000000000000000000000000000000000000000000000000" - blockResp := map[string]interface{}{ - "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", - "number": "0x1", - "parentHash": emptyBlockHash, - "timestamp": "0x0", - "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", - "receiptsRoot": emptyBlockHash, - "transactionsRoot": emptyBlockHash, - "sha3Uncles": emptyBlockHash, - "logsBloom": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "difficulty": "0x0", - "totalDifficulty": "0x0", - "size": "0x0", - "gasLimit": "0x1000000", - "gasUsed": "0x0", - "miner": "0x0000000000000000000000000000000000000000", - "extraData": "0x", - "mixHash": emptyBlockHash, - "nonce": "0x0000000000000000", - "baseFeePerGas": "0x0", - "uncles": []interface{}{}, - } - - if fullTx { - blockResp["transactions"] = []interface{}{} - } else { - blockResp["transactions"] = []interface{}{} - } - - resp = blockResp - } - t.Logf("Requested block number: %s, Matching: %v", blockNum, blockNum == "0x1") - } - - t.Logf("Request: %s, Params: %v", method, req["params"]) - t.Logf("Response: %v", resp) - - json.NewEncoder(w).Encode(map[string]interface{}{ - "jsonrpc": "2.0", - "id": req["id"], - "result": resp, - }) - })) - - return mock -} - func TestEngineAPIExecutionClient_InitChain(t *testing.T) { - mockEngine := newMockEngineAPI(t) + mockEngine := mocks.NewMockEngineAPI(t) defer mockEngine.Close() - mockEth := newMockEthAPI(t) + mockEth := mocks.NewMockEthAPI(t) defer mockEth.Close() client, err := NewEngineAPIExecutionClient( @@ -197,7 +39,7 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { require.NoError(t, err) mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") - var expectedStateRoot go_execution_types.Hash + var expectedStateRoot execution_types.Hash copy(expectedStateRoot[:], mockStateRoot.Bytes()) require.Equal(t, expectedStateRoot, stateRoot) @@ -205,10 +47,10 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { } func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { - mockEngine := newMockEngineAPI(t) + mockEngine := mocks.NewMockEngineAPI(t) defer mockEngine.Close() - mockEth := newMockEthAPI(t) + mockEth := mocks.NewMockEthAPI(t) defer mockEth.Close() client, err := NewEngineAPIExecutionClient( @@ -270,10 +112,10 @@ func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { } func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { - mockEngine := newMockEngineAPI(t) + mockEngine := mocks.NewMockEngineAPI(t) defer mockEngine.Close() - mockEth := newMockEthAPI(t) + mockEth := mocks.NewMockEthAPI(t) defer mockEth.Close() client, err := NewEngineAPIExecutionClient( @@ -288,13 +130,13 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { blockHeight := uint64(1) timestamp := time.Now().UTC().Truncate(time.Second) - var prevStateRoot go_execution_types.Hash + var prevStateRoot execution_types.Hash copy(prevStateRoot[:], []byte{1, 2, 3}) - testTx := go_execution_types.Tx("test transaction") + testTx := execution_types.Tx("test transaction") stateRoot, gasUsed, err := client.ExecuteTxs( - []go_execution_types.Tx{testTx}, + []execution_types.Tx{testTx}, blockHeight, timestamp, prevStateRoot, @@ -302,7 +144,7 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { require.NoError(t, err) mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") - var expectedStateRoot go_execution_types.Hash + var expectedStateRoot execution_types.Hash copy(expectedStateRoot[:], mockStateRoot.Bytes()) require.Equal(t, expectedStateRoot, stateRoot) diff --git a/go.mod b/go.mod index 889cb94..9c9ffad 100644 --- a/go.mod +++ b/go.mod @@ -59,6 +59,7 @@ require ( github.com/rs/cors v1.11.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/supranational/blst v0.3.13 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect diff --git a/mocks/mocks.go b/mocks/mocks.go new file mode 100644 index 0000000..65978e9 --- /dev/null +++ b/mocks/mocks.go @@ -0,0 +1,166 @@ +package mocks + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + "net/http/httptest" + "testing" + + "github.com/stretchr/testify/require" +) + +type MockEngineAPI struct { + *httptest.Server +} + +func NewMockEngineAPI(t *testing.T) *MockEngineAPI { + t.Helper() + + mock := &MockEngineAPI{} + mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var resp map[string]interface{} + + body, err := io.ReadAll(r.Body) + require.NoError(t, err) + + var req map[string]interface{} + err = json.Unmarshal(body, &req) + require.NoError(t, err) + + method := req["method"].(string) + switch method { + case "engine_newPayloadV1": + resp = map[string]interface{}{ + "status": "VALID", + "latestValidHash": "0x1234", + } + case "engine_forkchoiceUpdatedV1": + resp = map[string]interface{}{ + "payloadStatus": map[string]interface{}{ + "status": "VALID", + }, + "payloadId": "0x1234", + } + case "engine_getPayloadV1": + resp = map[string]interface{}{ + "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "gasUsed": float64(21000), + "gasLimit": float64(1000000), + } + } + + json.NewEncoder(w).Encode(map[string]interface{}{ + "jsonrpc": "2.0", + "id": req["id"], + "result": resp, + }) + })) + + return mock +} + +type MockEthAPI struct { + *httptest.Server +} + +func NewMockEthAPI(t *testing.T) *MockEthAPI { + t.Helper() + + mock := &MockEthAPI{} + mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var resp interface{} + + body, err := io.ReadAll(r.Body) + require.NoError(t, err) + + var req map[string]interface{} + err = json.Unmarshal(body, &req) + require.NoError(t, err) + + method := req["method"].(string) + switch method { + case "txpool_content": + resp = map[string]interface{}{ + "pending": map[string]interface{}{ + "0x1234567890123456789012345678901234567890": map[string]interface{}{ + "0": map[string]interface{}{ + "input": "0x123456", + "nonce": "0x0", + "from": "0x1234567890123456789012345678901234567890", + "to": "0x0987654321098765432109876543210987654321", + "value": "0x0", + "gas": "0x5208", + "gasPrice": "0x3b9aca00", + "chainId": "0x1", + "v": "0x1b", + "r": "0x1234", + "s": "0x5678", + "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", + "type": "0x0", + }, + }, + }, + "queued": map[string]interface{}{}, + } + case "eth_getBlockByNumber", "eth_blockByNumber": + params := req["params"].([]interface{}) + blockNumRaw := params[0] + fullTx := false + if len(params) > 1 { + fullTx = params[1].(bool) + } + + var blockNum string + switch v := blockNumRaw.(type) { + case string: + blockNum = v + case float64: + blockNum = fmt.Sprintf("0x%x", int64(v)) + } + + if blockNum == "0x1" { + emptyBlockHash := "0x0000000000000000000000000000000000000000000000000000000000000000" + blockResp := map[string]interface{}{ + "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", + "number": "0x1", + "parentHash": emptyBlockHash, + "timestamp": "0x0", + "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "receiptsRoot": emptyBlockHash, + "transactionsRoot": emptyBlockHash, + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "difficulty": "0x0", + "totalDifficulty": "0x0", + "size": "0x0", + "gasLimit": "0x1000000", + "gasUsed": "0x0", + "miner": "0x0000000000000000000000000000000000000000", + "extraData": "0x", + "mixHash": emptyBlockHash, + "nonce": "0x0000000000000000", + "baseFeePerGas": "0x0", + "uncles": []interface{}{}, + } + + if fullTx { + blockResp["transactions"] = []interface{}{} + } else { + blockResp["transactions"] = []interface{}{} + } + + resp = blockResp + } + } + + json.NewEncoder(w).Encode(map[string]interface{}{ + "jsonrpc": "2.0", + "id": req["id"], + "result": resp, + }) + })) + + return mock +} From d222190a43c91cf270d25b28426abe49239284d6 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Thu, 7 Nov 2024 18:26:01 -0800 Subject: [PATCH 15/43] test: SetFinal unit test passing --- execution_test.go | 25 ++++++++++++++++++++++++- mocks/mocks.go | 45 +++++++++++++++++++++++++++++++-------------- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/execution_test.go b/execution_test.go index a8b9baa..7b12906 100644 --- a/execution_test.go +++ b/execution_test.go @@ -152,5 +152,28 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { } func TestEngineAPIExecutionClient_SetFinal(t *testing.T) { - // TO-DO + mockEngine := mocks.NewMockEngineAPI(t) + defer mockEngine.Close() + + mockEth := mocks.NewMockEthAPI(t) + defer mockEth.Close() + + client, err := NewEngineAPIExecutionClient( + &proxy_json_rpc.Config{}, + mockEth.URL, + mockEngine.URL, + common.Hash{}, + common.Address{}, + ) + require.NoError(t, err) + + blockHeight := uint64(1) + err = client.SetFinal(blockHeight) + require.NoError(t, err) + + lastCall := mockEngine.GetLastForkchoiceUpdated() + require.NotNil(t, lastCall) + + expectedBlockHash := "0x4bbb1357b89ddc1b1371f9ae83b72739a1815628f8648665fc332c3f0fb8d853" + require.Equal(t, expectedBlockHash, lastCall.FinalizedBlockHash) } diff --git a/mocks/mocks.go b/mocks/mocks.go index 65978e9..e9db355 100644 --- a/mocks/mocks.go +++ b/mocks/mocks.go @@ -6,6 +6,7 @@ import ( "io" "net/http" "net/http/httptest" + "strings" "testing" "github.com/stretchr/testify/require" @@ -15,6 +16,14 @@ type MockEngineAPI struct { *httptest.Server } +type ForkchoiceState struct { + HeadBlockHash string + SafeBlockHash string + FinalizedBlockHash string +} + +var lastForkchoiceUpdate *ForkchoiceState + func NewMockEngineAPI(t *testing.T) *MockEngineAPI { t.Helper() @@ -37,6 +46,15 @@ func NewMockEngineAPI(t *testing.T) *MockEngineAPI { "latestValidHash": "0x1234", } case "engine_forkchoiceUpdatedV1": + params := req["params"].([]interface{}) + forkchoiceState := params[0].(map[string]interface{}) + + lastForkchoiceUpdate = &ForkchoiceState{ + HeadBlockHash: forkchoiceState["headBlockHash"].(string), + SafeBlockHash: forkchoiceState["safeBlockHash"].(string), + FinalizedBlockHash: forkchoiceState["finalizedBlockHash"].(string), + } + resp = map[string]interface{}{ "payloadStatus": map[string]interface{}{ "status": "VALID", @@ -107,10 +125,6 @@ func NewMockEthAPI(t *testing.T) *MockEthAPI { case "eth_getBlockByNumber", "eth_blockByNumber": params := req["params"].([]interface{}) blockNumRaw := params[0] - fullTx := false - if len(params) > 1 { - fullTx = params[1].(bool) - } var blockNum string switch v := blockNumRaw.(type) { @@ -121,17 +135,21 @@ func NewMockEthAPI(t *testing.T) *MockEthAPI { } if blockNum == "0x1" { + emptyTrieRoot := "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" emptyBlockHash := "0x0000000000000000000000000000000000000000000000000000000000000000" + emptyBloom := "0x" + strings.Repeat("0", 512) + blockHash := "0x4bbb1357b89ddc1b1371f9ae83b72739a1815628f8648665fc332c3f0fb8d853" + blockResp := map[string]interface{}{ - "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", + "hash": blockHash, "number": "0x1", "parentHash": emptyBlockHash, "timestamp": "0x0", "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", - "receiptsRoot": emptyBlockHash, - "transactionsRoot": emptyBlockHash, + "receiptsRoot": emptyTrieRoot, + "transactionsRoot": emptyTrieRoot, "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "logsBloom": emptyBloom, "difficulty": "0x0", "totalDifficulty": "0x0", "size": "0x0", @@ -143,12 +161,7 @@ func NewMockEthAPI(t *testing.T) *MockEthAPI { "nonce": "0x0000000000000000", "baseFeePerGas": "0x0", "uncles": []interface{}{}, - } - - if fullTx { - blockResp["transactions"] = []interface{}{} - } else { - blockResp["transactions"] = []interface{}{} + "transactions": []interface{}{}, } resp = blockResp @@ -164,3 +177,7 @@ func NewMockEthAPI(t *testing.T) *MockEthAPI { return mock } + +func (m *MockEngineAPI) GetLastForkchoiceUpdated() *ForkchoiceState { + return lastForkchoiceUpdate +} From ee613fcc9c84de9682f99a4a57a198b89a018574 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Mon, 11 Nov 2024 17:58:47 -0800 Subject: [PATCH 16/43] chore: add ctx in executor methods --- execution.go | 16 ++++------------ execution_test.go | 14 ++++++++++---- go.mod | 3 +-- go.sum | 4 ++-- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/execution.go b/execution.go index e90286e..79910c2 100644 --- a/execution.go +++ b/execution.go @@ -84,9 +84,7 @@ func (c *EngineAPIExecutionClient) Stop() { } // InitChain initializes the blockchain with genesis information -func (c *EngineAPIExecutionClient) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (execution_types.Hash, uint64, error) { - ctx := context.Background() - +func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime time.Time, initialHeight uint64, chainID string) (execution_types.Hash, uint64, error) { var forkchoiceResult map[string]interface{} err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", map[string]interface{}{ @@ -123,9 +121,7 @@ func (c *EngineAPIExecutionClient) InitChain(genesisTime time.Time, initialHeigh } // GetTxs retrieves transactions from the transaction pool -func (c *EngineAPIExecutionClient) GetTxs() ([]execution_types.Tx, error) { - ctx := context.Background() - +func (c *EngineAPIExecutionClient) GetTxs(ctx context.Context) ([]execution_types.Tx, error) { var result struct { Pending map[string]map[string]*types.Transaction `json:"pending"` Queued map[string]map[string]*types.Transaction `json:"queued"` @@ -162,9 +158,7 @@ func (c *EngineAPIExecutionClient) GetTxs() ([]execution_types.Tx, error) { } // ExecuteTxs executes the given transactions and returns the new state root and gas used -func (c *EngineAPIExecutionClient) ExecuteTxs(txs []execution_types.Tx, height uint64, timestamp time.Time, prevStateRoot execution_types.Hash) (execution_types.Hash, uint64, error) { - ctx := context.Background() - +func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []execution_types.Tx, height uint64, timestamp time.Time, prevStateRoot execution_types.Hash) (execution_types.Hash, uint64, error) { ethTxs := make([][]byte, len(txs)) for i, tx := range txs { ethTxs[i] = tx @@ -226,9 +220,7 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(txs []execution_types.Tx, height u } // SetFinal marks a block at the given height as final -func (c *EngineAPIExecutionClient) SetFinal(height uint64) error { - ctx := context.Background() - +func (c *EngineAPIExecutionClient) SetFinal(ctx context.Context, height uint64) error { block, err := c.ethClient.BlockByNumber(ctx, big.NewInt(int64(height))) if err != nil { return fmt.Errorf("failed to get block at height %d: %w", height, err) diff --git a/execution_test.go b/execution_test.go index 7b12906..23cc3f6 100644 --- a/execution_test.go +++ b/execution_test.go @@ -1,6 +1,7 @@ package execution import ( + "context" "encoding/json" "io" "net/http" @@ -35,7 +36,8 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { initialHeight := uint64(0) chainID := "11155111" // sepolia chain id - stateRoot, gasLimit, err := client.InitChain(genesisTime, initialHeight, chainID) + ctx := context.Background() + stateRoot, gasLimit, err := client.InitChain(ctx, genesisTime, initialHeight, chainID) require.NoError(t, err) mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") @@ -60,8 +62,8 @@ func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { common.Hash{}, common.Address{}, ) - require.NoError(t, err) + mockEth.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var resp interface{} @@ -105,7 +107,8 @@ func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { }) })) - txs, err := client.GetTxs() + ctx := context.Background() + txs, err := client.GetTxs(ctx) require.NoError(t, err) require.NotEmpty(t, txs) require.Greater(t, len(txs), 0) @@ -135,7 +138,9 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { testTx := execution_types.Tx("test transaction") + ctx := context.Background() stateRoot, gasUsed, err := client.ExecuteTxs( + ctx, []execution_types.Tx{testTx}, blockHeight, timestamp, @@ -168,7 +173,8 @@ func TestEngineAPIExecutionClient_SetFinal(t *testing.T) { require.NoError(t, err) blockHeight := uint64(1) - err = client.SetFinal(blockHeight) + ctx := context.Background() + err = client.SetFinal(ctx, blockHeight) require.NoError(t, err) lastCall := mockEngine.GetLastForkchoiceUpdated() diff --git a/go.mod b/go.mod index 9c9ffad..be8ee4d 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/rollkit/go-execution-evm go 1.22.8 -replace github.com/rollkit/go-execution => github.com/lastdotnet/go-execution v0.0.0-20241107213138-d1712b8c4d58 +replace github.com/rollkit/go-execution => github.com/lastdotnet/go-execution v0.0.0-20241108025553-291f75953069 require ( github.com/ethereum/go-ethereum v1.14.11 @@ -59,7 +59,6 @@ require ( github.com/rs/cors v1.11.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/stretchr/objx v0.5.2 // indirect github.com/supranational/blst v0.3.13 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect diff --git a/go.sum b/go.sum index 1682f35..81916d3 100644 --- a/go.sum +++ b/go.sum @@ -143,8 +143,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lastdotnet/go-execution v0.0.0-20241107213138-d1712b8c4d58 h1:sjinTQV5doakYIhNFcDUzcfdmJzdIhKvdZuXo+z2+Jc= -github.com/lastdotnet/go-execution v0.0.0-20241107213138-d1712b8c4d58/go.mod h1:JYUo1RXqdVQjuOFhU8oO6g7pKOk29ZFsdizMXkHwVdA= +github.com/lastdotnet/go-execution v0.0.0-20241108025553-291f75953069 h1:GnaHqG+ixzkaBtWzvaZCpNgNZnsf/liacgK39t55nHE= +github.com/lastdotnet/go-execution v0.0.0-20241108025553-291f75953069/go.mod h1:JYUo1RXqdVQjuOFhU8oO6g7pKOk29ZFsdizMXkHwVdA= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= From 40257d9eaffcf4c99d21d9c5aa644fdde96db3b5 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Mon, 11 Nov 2024 19:02:44 -0800 Subject: [PATCH 17/43] feat: upgrade to engine api cancun --- execution.go | 65 +++++++++++++++++++------------ execution_test.go | 98 +++++++++++++++++++++++++++-------------------- mocks/mocks.go | 37 ++++++++++++++---- 3 files changed, 126 insertions(+), 74 deletions(-) diff --git a/execution.go b/execution.go index 79910c2..034de81 100644 --- a/execution.go +++ b/execution.go @@ -86,7 +86,7 @@ func (c *EngineAPIExecutionClient) Stop() { // InitChain initializes the blockchain with genesis information func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime time.Time, initialHeight uint64, chainID string) (execution_types.Hash, uint64, error) { var forkchoiceResult map[string]interface{} - err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", map[string]interface{}{ "headBlockHash": c.genesisHash, "safeBlockHash": c.genesisHash, @@ -96,10 +96,11 @@ func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime ti "timestamp": genesisTime.Unix(), "prevRandao": common.Hash{}, "suggestedFeeRecipient": c.feeRecipient, + "parentBeaconBlockRoot": common.Hash{}, }, ) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV3 failed: %w", err) } payloadID, ok := forkchoiceResult["payloadId"].(string) @@ -108,16 +109,21 @@ func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime ti } var payloadResult map[string]interface{} - err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV1", payloadID) + err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", payloadID) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV3 failed: %w", err) } - stateRoot := common.HexToHash(payloadResult["stateRoot"].(string)) - gasLimit := uint64(payloadResult["gasLimit"].(float64)) + executionPayload := payloadResult["executionPayload"].(map[string]interface{}) + stateRoot := common.HexToHash(executionPayload["stateRoot"].(string)) + + gasLimitHex := executionPayload["gasLimit"].(string) + gasLimit := new(big.Int) + gasLimit.SetString(gasLimitHex[2:], 16) + var rollkitStateRoot execution_types.Hash copy(rollkitStateRoot[:], stateRoot[:]) - return rollkitStateRoot, gasLimit, nil + return rollkitStateRoot, gasLimit.Uint64(), nil } // GetTxs retrieves transactions from the transaction pool @@ -164,17 +170,18 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi ethTxs[i] = tx } - // call engine_newPayloadV1 with the txs var newPayloadResult map[string]interface{} - err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV1", map[string]interface{}{ - "parentHash": common.BytesToHash(prevStateRoot[:]), - "timestamp": timestamp.Unix(), - "prevRandao": c.derivePrevRandao(height), - "feeRecipient": c.feeRecipient, - "transactions": ethTxs, + err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", map[string]interface{}{ + "parentHash": common.BytesToHash(prevStateRoot[:]), + "timestamp": timestamp.Unix(), + "prevRandao": c.derivePrevRandao(height), + "feeRecipient": c.feeRecipient, + "transactions": ethTxs, + "expectedBlobVersionedHashes": []string{}, + "parentBeaconBlockRoot": common.Hash{}, }) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %w", err) } status, ok := newPayloadResult["status"].(string) @@ -184,7 +191,7 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi // update fork choice var forkchoiceResult map[string]interface{} - err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", map[string]interface{}{ "headBlockHash": common.BytesToHash(prevStateRoot[:]), "safeBlockHash": common.BytesToHash(prevStateRoot[:]), @@ -194,10 +201,11 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi "timestamp": timestamp.Unix(), "prevRandao": c.derivePrevRandao(height), "suggestedFeeRecipient": c.feeRecipient, + "parentBeaconBlockRoot": common.Hash{}, }, ) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV3 failed: %w", err) } // get the execution results @@ -207,16 +215,21 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi return execution_types.Hash{}, 0, ErrNilPayloadStatus } - err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV1", payloadID) + err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", payloadID) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV1 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV3 failed: %w", err) } - newStateRoot := common.HexToHash(payloadResult["stateRoot"].(string)) - gasUsed := uint64(payloadResult["gasUsed"].(float64)) + executionPayload := payloadResult["executionPayload"].(map[string]interface{}) + newStateRoot := common.HexToHash(executionPayload["stateRoot"].(string)) + + gasUsedHex := executionPayload["gasUsed"].(string) + gasUsed := new(big.Int) + gasUsed.SetString(gasUsedHex[2:], 16) + var rollkitNewStateRoot execution_types.Hash copy(rollkitNewStateRoot[:], newStateRoot[:]) - return rollkitNewStateRoot, gasUsed, nil + return rollkitNewStateRoot, gasUsed.Uint64(), nil } // SetFinal marks a block at the given height as final @@ -227,16 +240,18 @@ func (c *EngineAPIExecutionClient) SetFinal(ctx context.Context, height uint64) } var forkchoiceResult map[string]interface{} - err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV1", + err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", map[string]interface{}{ "headBlockHash": block.Hash(), "safeBlockHash": block.Hash(), "finalizedBlockHash": block.Hash(), }, - nil, // No payload attributes for finalization + map[string]interface{}{ + "parentBeaconBlockRoot": common.Hash{}, + }, ) if err != nil { - return fmt.Errorf("engine_forkchoiceUpdatedV1 failed for finalization: %w", err) + return fmt.Errorf("engine_forkchoiceUpdatedV3 failed for finalization: %w", err) } payloadStatus, ok := forkchoiceResult["payloadStatus"].(map[string]interface{}) diff --git a/execution_test.go b/execution_test.go index 23cc3f6..8ee86ea 100644 --- a/execution_test.go +++ b/execution_test.go @@ -46,6 +46,60 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { require.Equal(t, expectedStateRoot, stateRoot) require.Equal(t, uint64(1000000), gasLimit) + + lastCall := mockEngine.GetLastForkchoiceUpdated() + require.NotNil(t, lastCall) + require.Equal(t, common.Hash{}.Hex(), lastCall.HeadBlockHash) + require.Equal(t, common.Hash{}.Hex(), lastCall.SafeBlockHash) + require.Equal(t, common.Hash{}.Hex(), lastCall.FinalizedBlockHash) +} + +func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { + mockEngine := mocks.NewMockEngineAPI(t) + defer mockEngine.Close() + + mockEth := mocks.NewMockEthAPI(t) + defer mockEth.Close() + + client, err := NewEngineAPIExecutionClient( + &proxy_json_rpc.Config{}, + mockEth.URL, + mockEngine.URL, + common.Hash{}, + common.Address{}, + ) + require.NoError(t, err) + + blockHeight := uint64(1) + timestamp := time.Now().UTC().Truncate(time.Second) + + var prevStateRoot execution_types.Hash + copy(prevStateRoot[:], []byte{1, 2, 3}) + + testTx := execution_types.Tx("test transaction") + + ctx := context.Background() + stateRoot, gasUsed, err := client.ExecuteTxs( + ctx, + []execution_types.Tx{testTx}, + blockHeight, + timestamp, + prevStateRoot, + ) + require.NoError(t, err) + + lastCall := mockEngine.GetLastForkchoiceUpdated() + require.NotNil(t, lastCall) + require.Equal(t, common.BytesToHash(prevStateRoot[:]).Hex(), lastCall.HeadBlockHash) + require.Equal(t, common.BytesToHash(prevStateRoot[:]).Hex(), lastCall.SafeBlockHash) + require.Equal(t, common.BytesToHash(prevStateRoot[:]).Hex(), lastCall.FinalizedBlockHash) + + mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") + var expectedStateRoot execution_types.Hash + copy(expectedStateRoot[:], mockStateRoot.Bytes()) + + require.Equal(t, expectedStateRoot, stateRoot) + require.Equal(t, uint64(21000), gasUsed) } func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { @@ -114,48 +168,6 @@ func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { require.Greater(t, len(txs), 0) } -func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { - mockEngine := mocks.NewMockEngineAPI(t) - defer mockEngine.Close() - - mockEth := mocks.NewMockEthAPI(t) - defer mockEth.Close() - - client, err := NewEngineAPIExecutionClient( - &proxy_json_rpc.Config{}, - mockEth.URL, - mockEngine.URL, - common.Hash{}, - common.Address{}, - ) - require.NoError(t, err) - - blockHeight := uint64(1) - timestamp := time.Now().UTC().Truncate(time.Second) - - var prevStateRoot execution_types.Hash - copy(prevStateRoot[:], []byte{1, 2, 3}) - - testTx := execution_types.Tx("test transaction") - - ctx := context.Background() - stateRoot, gasUsed, err := client.ExecuteTxs( - ctx, - []execution_types.Tx{testTx}, - blockHeight, - timestamp, - prevStateRoot, - ) - require.NoError(t, err) - - mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") - var expectedStateRoot execution_types.Hash - copy(expectedStateRoot[:], mockStateRoot.Bytes()) - - require.Equal(t, expectedStateRoot, stateRoot) - require.Equal(t, uint64(21000), gasUsed) -} - func TestEngineAPIExecutionClient_SetFinal(t *testing.T) { mockEngine := mocks.NewMockEngineAPI(t) defer mockEngine.Close() @@ -182,4 +194,6 @@ func TestEngineAPIExecutionClient_SetFinal(t *testing.T) { expectedBlockHash := "0x4bbb1357b89ddc1b1371f9ae83b72739a1815628f8648665fc332c3f0fb8d853" require.Equal(t, expectedBlockHash, lastCall.FinalizedBlockHash) + require.Equal(t, expectedBlockHash, lastCall.HeadBlockHash) + require.Equal(t, expectedBlockHash, lastCall.SafeBlockHash) } diff --git a/mocks/mocks.go b/mocks/mocks.go index e9db355..4f83b9b 100644 --- a/mocks/mocks.go +++ b/mocks/mocks.go @@ -40,12 +40,13 @@ func NewMockEngineAPI(t *testing.T) *MockEngineAPI { method := req["method"].(string) switch method { - case "engine_newPayloadV1": + case "engine_newPayloadV3": resp = map[string]interface{}{ "status": "VALID", "latestValidHash": "0x1234", + "validationError": nil, } - case "engine_forkchoiceUpdatedV1": + case "engine_forkchoiceUpdatedV3": params := req["params"].([]interface{}) forkchoiceState := params[0].(map[string]interface{}) @@ -57,15 +58,37 @@ func NewMockEngineAPI(t *testing.T) *MockEngineAPI { resp = map[string]interface{}{ "payloadStatus": map[string]interface{}{ - "status": "VALID", + "status": "VALID", + "latestValidHash": nil, + "validationError": nil, }, "payloadId": "0x1234", } - case "engine_getPayloadV1": + case "engine_getPayloadV3": resp = map[string]interface{}{ - "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", - "gasUsed": float64(21000), - "gasLimit": float64(1000000), + "executionPayload": map[string]interface{}{ + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "feeRecipient": "0x0000000000000000000000000000000000000000", + "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "logsBloom": "0x00000000000000000000000000000000", + "prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", + "blockNumber": "0x0", + "gasLimit": "0xf4240", + "gasUsed": "0x5208", + "timestamp": "0x0", + "extraData": "0x", + "baseFeePerGas": "0x0", + "blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "transactions": []string{}, + }, + "blockValue": "0x0", + "blobsBundle": map[string]interface{}{ + "commitments": []string{}, + "proofs": []string{}, + "blobs": []string{}, + }, + "shouldOverrideBuilder": false, } } From e0957ca4a7881ecdcacf1bb6774625f039cbb0a1 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Thu, 7 Nov 2024 15:06:23 -0600 Subject: [PATCH 18/43] spin up local network for tests --- docker/docker-compose.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b3f3f65..4eec7d8 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -36,10 +36,11 @@ services: - holesky_data:/root/.local/share/reth/holesky - logs:/root/logs - ./jwttoken:/root/jwt:ro + - ./chain:/root/chain pid: host command: > node - --chain sepolia + --chain /root/chain/genesis.json --metrics 0.0.0.0:9001 --log.file.directory /root/logs --authrpc.addr 0.0.0.0 @@ -47,6 +48,9 @@ services: --authrpc.jwtsecret /root/jwt/jwt.hex --http --http.addr 0.0.0.0 --http.port 8545 --http.api "eth,net,web3" + --disable-discovery + --debug.tip 0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216 + -vvvv volumes: mainnet_data: From 764240e878704a2c3a6f04cdb4be30bb4632a1ea Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Thu, 7 Nov 2024 15:32:12 -0600 Subject: [PATCH 19/43] init reth db for the local test network --- docker/chain/genesis.json | 31 +++++++++++++++++++++++++++++++ docker/docker-compose.yml | 29 ++++++++++++++++------------- 2 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 docker/chain/genesis.json diff --git a/docker/chain/genesis.json b/docker/chain/genesis.json new file mode 100644 index 0000000..f3ae08d --- /dev/null +++ b/docker/chain/genesis.json @@ -0,0 +1,31 @@ +{ + "config": { + "chainId": 1234, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "londonBlock": 0 + }, + "alloc": { + "0xd143C405751162d0F96bEE2eB5eb9C61882a736E": { + "balance": "0x4a47e3c12448f4ad000000" + }, + "0x944fDcD1c868E3cC566C78023CcB38A32cDA836E": { + "balance": "0x4a47e3c12448f4ad000000" + } + }, + "coinbase": "0x0000000000000000000000000000000000000000", + "difficulty": "0x20000", + "extraData": "", + "gasLimit": "0xf4240", + "nonce": "0x0000000000000042", + "mixhash": "0x2c85bcbce56429100b2108254bb56906257582aeafcbd682bc9af67a9f5aee46", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "0x00" + } \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 4eec7d8..da2bd90 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -38,19 +38,22 @@ services: - ./jwttoken:/root/jwt:ro - ./chain:/root/chain pid: host - command: > - node - --chain /root/chain/genesis.json - --metrics 0.0.0.0:9001 - --log.file.directory /root/logs - --authrpc.addr 0.0.0.0 - --authrpc.port 8551 - --authrpc.jwtsecret /root/jwt/jwt.hex - --http --http.addr 0.0.0.0 --http.port 8545 - --http.api "eth,net,web3" - --disable-discovery - --debug.tip 0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216 - -vvvv + entrypoint: /bin/sh -c + command: + - | + reth init /root/chain/genesis.json + reth node \ + --chain /root/chain/genesis.json \ + --metrics 0.0.0.0:9001 \ + --log.file.directory /root/logs \ + --authrpc.addr 0.0.0.0 \ + --authrpc.port 8551 \ + --authrpc.jwtsecret /root/jwt/jwt.hex \ + --http --http.addr 0.0.0.0 --http.port 8545 \ + --http.api "eth,net,web3" \ + --disable-discovery \ + --debug.tip 0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216 \ + -vvvv volumes: mainnet_data: From 6fc3ea59e13818cef74270457891fede555310db Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Thu, 7 Nov 2024 16:27:00 -0600 Subject: [PATCH 20/43] add integration tests --- docker/chain/genesis.json | 58 +++++++++++++-------------- integration_tests/integration_test.go | 38 ++++++++++++++++++ 2 files changed, 67 insertions(+), 29 deletions(-) create mode 100644 integration_tests/integration_test.go diff --git a/docker/chain/genesis.json b/docker/chain/genesis.json index f3ae08d..1a0b9c0 100644 --- a/docker/chain/genesis.json +++ b/docker/chain/genesis.json @@ -1,31 +1,31 @@ { - "config": { - "chainId": 1234, - "homesteadBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "petersburgBlock": 0, - "istanbulBlock": 0, - "berlinBlock": 0, - "londonBlock": 0 + "config": { + "chainId": 1234, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "londonBlock": 0 + }, + "alloc": { + "0xd143C405751162d0F96bEE2eB5eb9C61882a736E": { + "balance": "0x4a47e3c12448f4ad000000" }, - "alloc": { - "0xd143C405751162d0F96bEE2eB5eb9C61882a736E": { - "balance": "0x4a47e3c12448f4ad000000" - }, - "0x944fDcD1c868E3cC566C78023CcB38A32cDA836E": { - "balance": "0x4a47e3c12448f4ad000000" - } - }, - "coinbase": "0x0000000000000000000000000000000000000000", - "difficulty": "0x20000", - "extraData": "", - "gasLimit": "0xf4240", - "nonce": "0x0000000000000042", - "mixhash": "0x2c85bcbce56429100b2108254bb56906257582aeafcbd682bc9af67a9f5aee46", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "timestamp": "0x00" - } \ No newline at end of file + "0x944fDcD1c868E3cC566C78023CcB38A32cDA836E": { + "balance": "0x4a47e3c12448f4ad000000" + } + }, + "coinbase": "0x0000000000000000000000000000000000000000", + "difficulty": "0x20000", + "extraData": "", + "gasLimit": "0xf4240", + "nonce": "0x0000000000000042", + "mixhash": "0x2c85bcbce56429100b2108254bb56906257582aeafcbd682bc9af67a9f5aee46", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "0x00" +} \ No newline at end of file diff --git a/integration_tests/integration_test.go b/integration_tests/integration_test.go new file mode 100644 index 0000000..dcc7d13 --- /dev/null +++ b/integration_tests/integration_test.go @@ -0,0 +1,38 @@ +package integration_tests + +import ( + "testing" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/rollkit/go-execution-evm" + "github.com/stretchr/testify/require" + + proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" +) + +const ( + TEST_ETH_URL = "http://localhost:8545" + TEST_ENGINE_URL = "http://localhost:8551" + + CHAIN_ID = "1234" + GENESIS_HASH = "0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216" +) + +func TestEngineAPIExecutionClient_InitChain(t *testing.T) { + genesisHash := common.HexToHash(GENESIS_HASH) + client, err := execution.NewEngineAPIExecutionClient( + &proxy_json_rpc.Config{}, + TEST_ETH_URL, + TEST_ENGINE_URL, + genesisHash, + common.Address{}, + ) + require.NoError(t, err) + + genesisTime := time.Now().UTC().Truncate(time.Second) + initialHeight := uint64(0) + + _, _, err = client.InitChain(genesisTime, initialHeight, CHAIN_ID) + require.NoError(t, err) +} From 60623e8859389e3d05903a3eeebbcd0ff7309121 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Thu, 7 Nov 2024 19:22:11 -0600 Subject: [PATCH 21/43] merge changes - upgrade to cancun api --- execution.go | 34 ++++++++++++++++++++++-- execution_test.go | 4 +++ go.mod | 5 +++- go.sum | 2 ++ integration_tests/integration_test.go | 38 --------------------------- 5 files changed, 42 insertions(+), 41 deletions(-) delete mode 100644 integration_tests/integration_test.go diff --git a/execution.go b/execution.go index 034de81..983d6eb 100644 --- a/execution.go +++ b/execution.go @@ -2,15 +2,18 @@ package execution import ( "context" + "encoding/hex" "errors" "fmt" "math/big" + "net/http" "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" + "github.com/golang-jwt/jwt" execution "github.com/rollkit/go-execution" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" execution_types "github.com/rollkit/go-execution/types" @@ -42,7 +45,7 @@ type EngineAPIExecutionClient struct { } // NewEngineAPIExecutionClient creates a new instance of EngineAPIExecutionClient -func NewEngineAPIExecutionClient(proxyConfig *proxy_json_rpc.Config, ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { +func NewEngineAPIExecutionClient(proxyConfig *proxy_json_rpc.Config, ethURL, engineURL string, jwtSecret string,genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { proxyClient := proxy_json_rpc.NewClient() proxyClient.SetConfig(proxyConfig) @@ -51,7 +54,34 @@ func NewEngineAPIExecutionClient(proxyConfig *proxy_json_rpc.Config, ethURL, eng return nil, err } - engineClient, err := rpc.Dial(engineURL) + authToken := "" + if jwtSecret != "" { + // Decode hex secret to bytes + secret, err := hex.DecodeString(jwtSecret) + if err != nil { + return nil, err + } + + // Create a new token + token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ + "exp": time.Now().Add(time.Hour * 1).Unix(), // Expires in 1 hour + "iat": time.Now().Unix(), + }) + + // Sign the token with the decoded secret + authToken, err = token.SignedString(secret) + if err != nil { + return nil, err + } + } + + engineClient, err := rpc.DialOptions(context.Background(), engineURL, + rpc.WithHTTPAuth(func(h http.Header) error { + if authToken != "" { + h.Set("Authorization", "Bearer "+authToken) + } + return nil + })) if err != nil { return nil, err } diff --git a/execution_test.go b/execution_test.go index 8ee86ea..0598922 100644 --- a/execution_test.go +++ b/execution_test.go @@ -27,6 +27,7 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { &proxy_json_rpc.Config{}, mockEth.URL, mockEngine.URL, + "", common.Hash{}, common.Address{}, ) @@ -65,6 +66,7 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { &proxy_json_rpc.Config{}, mockEth.URL, mockEngine.URL, + "", common.Hash{}, common.Address{}, ) @@ -113,6 +115,7 @@ func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { &proxy_json_rpc.Config{}, mockEth.URL, mockEngine.URL, + "", common.Hash{}, common.Address{}, ) @@ -179,6 +182,7 @@ func TestEngineAPIExecutionClient_SetFinal(t *testing.T) { &proxy_json_rpc.Config{}, mockEth.URL, mockEngine.URL, + "", common.Hash{}, common.Address{}, ) diff --git a/go.mod b/go.mod index be8ee4d..850eceb 100644 --- a/go.mod +++ b/go.mod @@ -75,4 +75,7 @@ require ( rsc.io/tmplfunc v0.0.3 // indirect ) -require github.com/stretchr/testify v1.9.0 +require ( + github.com/golang-jwt/jwt v3.2.2+incompatible + github.com/stretchr/testify v1.9.0 +) diff --git a/go.sum b/go.sum index 81916d3..033f77f 100644 --- a/go.sum +++ b/go.sum @@ -91,6 +91,8 @@ github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= diff --git a/integration_tests/integration_test.go b/integration_tests/integration_test.go deleted file mode 100644 index dcc7d13..0000000 --- a/integration_tests/integration_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package integration_tests - -import ( - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/rollkit/go-execution-evm" - "github.com/stretchr/testify/require" - - proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" -) - -const ( - TEST_ETH_URL = "http://localhost:8545" - TEST_ENGINE_URL = "http://localhost:8551" - - CHAIN_ID = "1234" - GENESIS_HASH = "0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216" -) - -func TestEngineAPIExecutionClient_InitChain(t *testing.T) { - genesisHash := common.HexToHash(GENESIS_HASH) - client, err := execution.NewEngineAPIExecutionClient( - &proxy_json_rpc.Config{}, - TEST_ETH_URL, - TEST_ENGINE_URL, - genesisHash, - common.Address{}, - ) - require.NoError(t, err) - - genesisTime := time.Now().UTC().Truncate(time.Second) - initialHeight := uint64(0) - - _, _, err = client.InitChain(genesisTime, initialHeight, CHAIN_ID) - require.NoError(t, err) -} From 463b9c540475d30bfa97c7f8fc3179f712d339ea Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Thu, 7 Nov 2024 21:42:15 -0600 Subject: [PATCH 22/43] merge base: upgrade to cancun api --- execution.go | 2 +- execution_test.go | 158 ++++++++++++++++++++++++++ integration_tests/integration_test.go | 49 ++++++++ 3 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 integration_tests/integration_test.go diff --git a/execution.go b/execution.go index 983d6eb..52ce2b7 100644 --- a/execution.go +++ b/execution.go @@ -45,7 +45,7 @@ type EngineAPIExecutionClient struct { } // NewEngineAPIExecutionClient creates a new instance of EngineAPIExecutionClient -func NewEngineAPIExecutionClient(proxyConfig *proxy_json_rpc.Config, ethURL, engineURL string, jwtSecret string,genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { +func NewEngineAPIExecutionClient(proxyConfig *proxy_json_rpc.Config, ethURL, engineURL string, jwtSecret string, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { proxyClient := proxy_json_rpc.NewClient() proxyClient.SetConfig(proxyConfig) diff --git a/execution_test.go b/execution_test.go index 0598922..5a65cfb 100644 --- a/execution_test.go +++ b/execution_test.go @@ -3,6 +3,7 @@ package execution import ( "context" "encoding/json" + "fmt" "io" "net/http" "net/http/httptest" @@ -15,6 +16,163 @@ import ( execution_types "github.com/rollkit/go-execution/types" "github.com/stretchr/testify/require" ) +type mockEngineAPI struct { + *httptest.Server +} + +func newMockEngineAPI(t *testing.T) *mockEngineAPI { + t.Helper() + + mock := &mockEngineAPI{} + mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var resp map[string]interface{} + + body, err := io.ReadAll(r.Body) + require.NoError(t, err) + + var req map[string]interface{} + err = json.Unmarshal(body, &req) + require.NoError(t, err) + + method := req["method"].(string) + switch method { + case "engine_newPayloadV1": + resp = map[string]interface{}{ + "status": "VALID", + "latestValidHash": "0x1234", + } + case "engine_forkchoiceUpdatedV1": + resp = map[string]interface{}{ + "payloadStatus": map[string]interface{}{ + "status": "VALID", + }, + "payloadId": "0x1234", + } + case "engine_getPayloadV1": + resp = map[string]interface{}{ + "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "gasUsed": "0x5208", + "gasLimit": "0xf4240", + } + } + + json.NewEncoder(w).Encode(map[string]interface{}{ + "jsonrpc": "2.0", + "id": req["id"], + "result": resp, + }) + })) + + return mock +} + +type mockEthAPI struct { + *httptest.Server +} + +func newMockEthAPI(t *testing.T) *mockEthAPI { + t.Helper() + + mock := &mockEthAPI{} + mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var resp interface{} + + body, err := io.ReadAll(r.Body) + require.NoError(t, err) + + var req map[string]interface{} + err = json.Unmarshal(body, &req) + require.NoError(t, err) + + method := req["method"].(string) + switch method { + case "txpool_content": + resp = map[string]interface{}{ + "pending": map[string]interface{}{ + "0x1234567890123456789012345678901234567890": map[string]interface{}{ + "0": map[string]interface{}{ + "input": "0x123456", + "nonce": "0x0", + "from": "0x1234567890123456789012345678901234567890", + "to": "0x0987654321098765432109876543210987654321", + "value": "0x0", + "gas": "0x5208", + "gasPrice": "0x3b9aca00", + "chainId": "0x1", + "v": "0x1b", + "r": "0x1234", + "s": "0x5678", + "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", + "type": "0x0", + }, + }, + }, + "queued": map[string]interface{}{}, + } + case "eth_getBlockByNumber", "eth_blockByNumber": + params := req["params"].([]interface{}) + blockNumRaw := params[0] + fullTx := false + if len(params) > 1 { + fullTx = params[1].(bool) + } + + var blockNum string + switch v := blockNumRaw.(type) { + case string: + blockNum = v + case float64: + blockNum = fmt.Sprintf("0x%x", int64(v)) + } + + if blockNum == "0x1" { + emptyBlockHash := "0x0000000000000000000000000000000000000000000000000000000000000000" + blockResp := map[string]interface{}{ + "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", + "number": "0x1", + "parentHash": emptyBlockHash, + "timestamp": "0x0", + "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "receiptsRoot": emptyBlockHash, + "transactionsRoot": emptyBlockHash, + "sha3Uncles": emptyBlockHash, + "logsBloom": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "difficulty": "0x0", + "totalDifficulty": "0x0", + "size": "0x0", + "gasLimit": "0x1000000", + "gasUsed": "0x0", + "miner": "0x0000000000000000000000000000000000000000", + "extraData": "0x", + "mixHash": emptyBlockHash, + "nonce": "0x0000000000000000", + "baseFeePerGas": "0x0", + "uncles": []interface{}{}, + } + + if fullTx { + blockResp["transactions"] = []interface{}{} + } else { + blockResp["transactions"] = []interface{}{} + } + + resp = blockResp + } + t.Logf("Requested block number: %s, Matching: %v", blockNum, blockNum == "0x1") + } + + t.Logf("Request: %s, Params: %v", method, req["params"]) + t.Logf("Response: %v", resp) + + json.NewEncoder(w).Encode(map[string]interface{}{ + "jsonrpc": "2.0", + "id": req["id"], + "result": resp, + }) + })) + + return mock +} func TestEngineAPIExecutionClient_InitChain(t *testing.T) { mockEngine := mocks.NewMockEngineAPI(t) diff --git a/integration_tests/integration_test.go b/integration_tests/integration_test.go new file mode 100644 index 0000000..81e03ca --- /dev/null +++ b/integration_tests/integration_test.go @@ -0,0 +1,49 @@ +package integration_tests + +import ( + "testing" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/rollkit/go-execution-evm" + "github.com/stretchr/testify/require" + + proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" + rollkit_types "github.com/rollkit/go-execution/types" +) + +const ( + TEST_ETH_URL = "http://localhost:8545" + TEST_ENGINE_URL = "http://localhost:8551" + + CHAIN_ID = "1234" + GENESIS_HASH = "0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216" + // TODO: programatically spin up docker and share secrets + JWT_SECRET = "09a23c010d96caaebb21c193b85d30bbb62a9bac5bd0a684e9e91c77c811ca65" +) + +func TestEngineAPIExecutionClient_InitChain(t *testing.T) { + genesisHash := common.HexToHash(GENESIS_HASH) + client, err := execution.NewEngineAPIExecutionClient( + &proxy_json_rpc.Config{}, + TEST_ETH_URL, + TEST_ENGINE_URL, + JWT_SECRET, + genesisHash, + common.Address{}, + ) + require.NoError(t, err) + + genesisTime := time.Now().UTC().Truncate(time.Second) + initialHeight := uint64(0) + + stateRoot, gasLimit, err := client.InitChain(genesisTime, initialHeight, CHAIN_ID) + require.NoError(t, err) + + mockStateRoot := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") + var expectedStateRoot rollkit_types.Hash + copy(expectedStateRoot[:], mockStateRoot.Bytes()) + + require.Equal(t, expectedStateRoot, stateRoot) + require.Equal(t, uint64(1000000), gasLimit) +} From cab390bd86e207fb31fb66795faf754b68d76b0c Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Sun, 10 Nov 2024 09:37:46 -0600 Subject: [PATCH 23/43] programatically setup docker dependencies for integration tests --- .vscode/launch.json | 15 +++ docker/docker-compose.yml | 4 +- go.mod | 15 +++ go.sum | 27 +++++ integration_test.go | 141 ++++++++++++++++++++++++++ integration_tests/integration_test.go | 49 --------- 6 files changed, 200 insertions(+), 51 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 integration_test.go delete mode 100644 integration_tests/integration_test.go diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..608d3c6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Package", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${fileDirname}" + } + ] +} \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index da2bd90..36f9941 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -36,12 +36,12 @@ services: - holesky_data:/root/.local/share/reth/holesky - logs:/root/logs - ./jwttoken:/root/jwt:ro - - ./chain:/root/chain + - ./chain:/root/chain:ro pid: host entrypoint: /bin/sh -c command: - | - reth init /root/chain/genesis.json + reth init --chain /root/chain/genesis.json reth node \ --chain /root/chain/genesis.json \ --metrics 0.0.0.0:9001 \ diff --git a/go.mod b/go.mod index 850eceb..241028b 100644 --- a/go.mod +++ b/go.mod @@ -24,9 +24,16 @@ require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect + github.com/distribution/reference v0.6.0 // indirect + github.com/docker/docker v27.3.1+incompatible // indirect + github.com/docker/go-connections v0.5.0 // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect @@ -45,6 +52,7 @@ require ( github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect + github.com/moby/docker-image-spec v1.3.1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect @@ -55,6 +63,9 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rs/cors v1.11.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect @@ -62,6 +73,10 @@ require ( github.com/supranational/blst v0.3.13 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.26.0 // indirect diff --git a/go.sum b/go.sum index 033f77f..d78d18a 100644 --- a/go.sum +++ b/go.sum @@ -60,6 +60,12 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5il github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/docker/docker v27.3.1+incompatible h1:KttF0XoteNTicmUtBO0L2tP+J7FGRFTjaEF4k6WdhfI= +github.com/docker/docker v27.3.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= @@ -70,6 +76,8 @@ github.com/ethereum/go-ethereum v1.14.11 h1:8nFDCUUE67rPc6AKxFj7JKaOa2W/W1Rse3oS github.com/ethereum/go-ethereum v1.14.11/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A= github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= @@ -80,6 +88,11 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqG github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= @@ -197,6 +210,8 @@ github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8oh github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= @@ -226,6 +241,10 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk= github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= @@ -322,6 +341,14 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsr github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= diff --git a/integration_test.go b/integration_test.go new file mode 100644 index 0000000..27e42d2 --- /dev/null +++ b/integration_test.go @@ -0,0 +1,141 @@ +package execution + +import ( + "context" + "os" + "path/filepath" + "testing" + "time" + + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/client" + "github.com/docker/go-connections/nat" + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + + proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" + rollkit_types "github.com/rollkit/go-execution/types" +) + +const ( + TEST_ETH_URL = "http://localhost:8545" + TEST_ENGINE_URL = "http://localhost:8551" + + CHAIN_ID = "1234" + GENESIS_HASH = "0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216" + JWT_SECRET = "09a23c010d96caaebb21c193b85d30bbb62a9bac5bd0a684e9e91c77c811ca65" + + DOCKER_CHAIN_PATH = "./docker/chain" // path relative to the test file + DOCKER_JWTSECRET_PATH = "./docker/jwttoken/" // path relative to the test file + DOCKER_JWT_SECRET_FILE = "testsecret.hex" +) + +func setupTestRethEngine(t *testing.T) func() { + t.Helper() + + chainPath, err := filepath.Abs(DOCKER_CHAIN_PATH) + require.NoError(t, err) + + jwtSecretPath, err := filepath.Abs(DOCKER_JWTSECRET_PATH) + require.NoError(t, err) + + err = os.WriteFile(DOCKER_JWTSECRET_PATH+DOCKER_JWT_SECRET_FILE, []byte(JWT_SECRET), 0644) + require.NoError(t, err) + + cli, err := client.NewClientWithOpts() + require.NoError(t, err) + + rethContainer, err := cli.ContainerCreate(context.Background(), + &container.Config{ + Image: "ghcr.io/paradigmxyz/reth", + Entrypoint: []string{"/bin/sh", "-c"}, + Cmd: []string{ + ` + reth init --chain /root/chain/genesis.json && \ + reth node \ + --chain /root/chain/genesis.json \ + --metrics 0.0.0.0:9001 \ + --log.file.directory /root/logs \ + --authrpc.addr 0.0.0.0 \ + --authrpc.port 8551 \ + --authrpc.jwtsecret /root/jwt/testsecret.hex \ + --http --http.addr 0.0.0.0 --http.port 8545 \ + --http.api "eth,net,web3" \ + --disable-discovery \ + --debug.tip 0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216 \ + -vvvv + `, + }, + ExposedPorts: map[nat.Port]struct{}{ + nat.Port("8545/tcp"): {}, + nat.Port("8551/tcp"): {}, + }, + }, + &container.HostConfig{ + Binds: []string{ + chainPath + ":/root/chain:ro", + jwtSecretPath + ":/root/jwt:ro", + }, + PortBindings: nat.PortMap{ + nat.Port("8545/tcp"): []nat.PortBinding{ + { + HostIP: "0.0.0.0", + HostPort: "8545", + }, + }, + nat.Port("8551/tcp"): []nat.PortBinding{ + { + HostIP: "0.0.0.0", + HostPort: "8551", + }, + }, + }, + }, + nil, nil, "reth") + require.NoError(t, err) + + err = cli.ContainerStart(context.Background(), rethContainer.ID, container.StartOptions{}) + require.NoError(t, err) + + // a reasonable time to wait for the container to start! + // do we want a more predictable elaborate code to wait for the container to be running? + time.Sleep(50 * time.Millisecond) + + return func() { + err = cli.ContainerStop(context.Background(), rethContainer.ID, container.StopOptions{}) + require.NoError(t, err) + err = cli.ContainerRemove(context.Background(), rethContainer.ID, container.RemoveOptions{}) + require.NoError(t, err) + err = os.Remove(DOCKER_JWTSECRET_PATH+DOCKER_JWT_SECRET_FILE) + + require.NoError(t, err) + } +} + +func TestEngineAPIExecutionClient_engineLifecycle(t *testing.T) { + defer setupTestRethEngine(t)() + + genesisHash := common.HexToHash(GENESIS_HASH) + client, err := NewEngineAPIExecutionClient( + &proxy_json_rpc.Config{}, + TEST_ETH_URL, + TEST_ENGINE_URL, + JWT_SECRET, + genesisHash, + common.Address{}, + ) + require.NoError(t, err) + + genesisTime := time.Now().UTC().Truncate(time.Second) + initialHeight := uint64(0) + + stateRoot, gasLimit, err := client.InitChain(genesisTime, initialHeight, CHAIN_ID) + require.NoError(t, err) + + staterootHash := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") + var expectedStateRoot rollkit_types.Hash + copy(expectedStateRoot[:], staterootHash.Bytes()) + + require.Equal(t, expectedStateRoot, stateRoot) + require.Equal(t, uint64(1000000), gasLimit) +} diff --git a/integration_tests/integration_test.go b/integration_tests/integration_test.go deleted file mode 100644 index 81e03ca..0000000 --- a/integration_tests/integration_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package integration_tests - -import ( - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/rollkit/go-execution-evm" - "github.com/stretchr/testify/require" - - proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" - rollkit_types "github.com/rollkit/go-execution/types" -) - -const ( - TEST_ETH_URL = "http://localhost:8545" - TEST_ENGINE_URL = "http://localhost:8551" - - CHAIN_ID = "1234" - GENESIS_HASH = "0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216" - // TODO: programatically spin up docker and share secrets - JWT_SECRET = "09a23c010d96caaebb21c193b85d30bbb62a9bac5bd0a684e9e91c77c811ca65" -) - -func TestEngineAPIExecutionClient_InitChain(t *testing.T) { - genesisHash := common.HexToHash(GENESIS_HASH) - client, err := execution.NewEngineAPIExecutionClient( - &proxy_json_rpc.Config{}, - TEST_ETH_URL, - TEST_ENGINE_URL, - JWT_SECRET, - genesisHash, - common.Address{}, - ) - require.NoError(t, err) - - genesisTime := time.Now().UTC().Truncate(time.Second) - initialHeight := uint64(0) - - stateRoot, gasLimit, err := client.InitChain(genesisTime, initialHeight, CHAIN_ID) - require.NoError(t, err) - - mockStateRoot := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") - var expectedStateRoot rollkit_types.Hash - copy(expectedStateRoot[:], mockStateRoot.Bytes()) - - require.Equal(t, expectedStateRoot, stateRoot) - require.Equal(t, uint64(1000000), gasLimit) -} From aae31e79d9fff19b2ccbb96d1a476d59038f4c03 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Sun, 10 Nov 2024 21:46:48 -0600 Subject: [PATCH 24/43] fix integration test cleanup --- integration_test.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/integration_test.go b/integration_test.go index 27e42d2..09fba21 100644 --- a/integration_test.go +++ b/integration_test.go @@ -25,18 +25,18 @@ const ( GENESIS_HASH = "0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216" JWT_SECRET = "09a23c010d96caaebb21c193b85d30bbb62a9bac5bd0a684e9e91c77c811ca65" - DOCKER_CHAIN_PATH = "./docker/chain" // path relative to the test file + DOCKER_CHAIN_PATH = "./docker/chain" // path relative to the test file DOCKER_JWTSECRET_PATH = "./docker/jwttoken/" // path relative to the test file DOCKER_JWT_SECRET_FILE = "testsecret.hex" ) -func setupTestRethEngine(t *testing.T) func() { +func setupTestRethEngine(t *testing.T) { t.Helper() - chainPath, err := filepath.Abs(DOCKER_CHAIN_PATH) + chainPath, err := filepath.Abs(DOCKER_CHAIN_PATH) require.NoError(t, err) - jwtSecretPath, err := filepath.Abs(DOCKER_JWTSECRET_PATH) + jwtSecretPath, err := filepath.Abs(DOCKER_JWTSECRET_PATH) require.NoError(t, err) err = os.WriteFile(DOCKER_JWTSECRET_PATH+DOCKER_JWT_SECRET_FILE, []byte(JWT_SECRET), 0644) @@ -99,21 +99,20 @@ func setupTestRethEngine(t *testing.T) func() { // a reasonable time to wait for the container to start! // do we want a more predictable elaborate code to wait for the container to be running? - time.Sleep(50 * time.Millisecond) + time.Sleep(50 * time.Millisecond) - return func() { + t.Cleanup(func() { err = cli.ContainerStop(context.Background(), rethContainer.ID, container.StopOptions{}) require.NoError(t, err) err = cli.ContainerRemove(context.Background(), rethContainer.ID, container.RemoveOptions{}) require.NoError(t, err) - err = os.Remove(DOCKER_JWTSECRET_PATH+DOCKER_JWT_SECRET_FILE) - + err = os.Remove(DOCKER_JWTSECRET_PATH + DOCKER_JWT_SECRET_FILE) require.NoError(t, err) - } + }) } func TestEngineAPIExecutionClient_engineLifecycle(t *testing.T) { - defer setupTestRethEngine(t)() + setupTestRethEngine(t) genesisHash := common.HexToHash(GENESIS_HASH) client, err := NewEngineAPIExecutionClient( From 3f848ecab5988fe6f218863ab83cc514e6016066 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Tue, 12 Nov 2024 15:33:44 -0600 Subject: [PATCH 25/43] add integration test for GetTxs --- docker/docker-compose.yml | 2 +- integration_test.go | 64 +++++++++++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 14 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 36f9941..41710fb 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -50,7 +50,7 @@ services: --authrpc.port 8551 \ --authrpc.jwtsecret /root/jwt/jwt.hex \ --http --http.addr 0.0.0.0 --http.port 8545 \ - --http.api "eth,net,web3" \ + --http.api "eth,net,web3,txpool" \ --disable-discovery \ --debug.tip 0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216 \ -vvvv diff --git a/integration_test.go b/integration_test.go index 09fba21..48da464 100644 --- a/integration_test.go +++ b/integration_test.go @@ -2,6 +2,7 @@ package execution import ( "context" + "math/big" "os" "path/filepath" "testing" @@ -11,6 +12,10 @@ import ( "github.com/docker/docker/client" "github.com/docker/go-connections/nat" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" @@ -28,6 +33,9 @@ const ( DOCKER_CHAIN_PATH = "./docker/chain" // path relative to the test file DOCKER_JWTSECRET_PATH = "./docker/jwttoken/" // path relative to the test file DOCKER_JWT_SECRET_FILE = "testsecret.hex" + + TEST_PRIVATE_KEY = "cece4f25ac74deb1468965160c7185e07dff413f23fcadb611b05ca37ab0a52e" + TEST_TO_ADDRESS = "0x944fDcD1c868E3cC566C78023CcB38A32cDA836E" ) func setupTestRethEngine(t *testing.T) { @@ -60,7 +68,7 @@ func setupTestRethEngine(t *testing.T) { --authrpc.port 8551 \ --authrpc.jwtsecret /root/jwt/testsecret.hex \ --http --http.addr 0.0.0.0 --http.port 8545 \ - --http.api "eth,net,web3" \ + --http.api "eth,net,web3,txpool" \ --disable-discovery \ --debug.tip 0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216 \ -vvvv @@ -111,11 +119,15 @@ func setupTestRethEngine(t *testing.T) { }) } -func TestEngineAPIExecutionClient_engineLifecycle(t *testing.T) { - setupTestRethEngine(t) +func TestExecutionClientLifecycle(t *testing.T) { + // setupTestRethEngine(t) genesisHash := common.HexToHash(GENESIS_HASH) - client, err := NewEngineAPIExecutionClient( + + rpcClient, err := ethclient.Dial(TEST_ETH_URL) + require.NoError(t, err) + + executionClient, err := NewEngineAPIExecutionClient( &proxy_json_rpc.Config{}, TEST_ETH_URL, TEST_ENGINE_URL, @@ -125,16 +137,42 @@ func TestEngineAPIExecutionClient_engineLifecycle(t *testing.T) { ) require.NoError(t, err) - genesisTime := time.Now().UTC().Truncate(time.Second) - initialHeight := uint64(0) + t.Run("InitChain", func(t *testing.T) { + genesisTime := time.Now().UTC().Truncate(time.Second) + initialHeight := uint64(0) - stateRoot, gasLimit, err := client.InitChain(genesisTime, initialHeight, CHAIN_ID) - require.NoError(t, err) + stateRoot, gasLimit, err := executionClient.InitChain(genesisTime, initialHeight, CHAIN_ID) + require.NoError(t, err) + + staterootHash := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") + var expectedStateRoot rollkit_types.Hash + copy(expectedStateRoot[:], staterootHash.Bytes()) + + require.Equal(t, expectedStateRoot, stateRoot) + require.Equal(t, uint64(1000000), gasLimit) + }) - staterootHash := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") - var expectedStateRoot rollkit_types.Hash - copy(expectedStateRoot[:], staterootHash.Bytes()) + t.Run("GetTxs", func(t *testing.T) { + privateKey, err := crypto.HexToECDSA(TEST_PRIVATE_KEY) + require.NoError(t, err) + + chainId, _ := new(big.Int).SetString(CHAIN_ID, 10) + nonce := uint64(0) + txnValue := big.NewInt(1000000000000000000) + gasLimit := uint64(21000) + gasPrice := big.NewInt(30000000000) + toAddress := common.HexToAddress(TEST_TO_ADDRESS) + + tx := types.NewTransaction(nonce, toAddress, txnValue, gasLimit, gasPrice, nil) + + signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainId), privateKey) + require.NoError(t, err) - require.Equal(t, expectedStateRoot, stateRoot) - require.Equal(t, uint64(1000000), gasLimit) + err = rpcClient.SendTransaction(context.Background(), signedTx) + require.NoError(t, err) + + txs, err := executionClient.GetTxs() + require.NoError(t, err) + assert.NotEmpty(t, txs) + }) } From d9ca6fd1214cec3dd3f0b61f01af92631186bed7 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Tue, 12 Nov 2024 18:09:17 -0600 Subject: [PATCH 26/43] fix getTxs integration test to assert the tx in mempool --- integration_test.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/integration_test.go b/integration_test.go index 48da464..32e1bb9 100644 --- a/integration_test.go +++ b/integration_test.go @@ -35,7 +35,7 @@ const ( DOCKER_JWT_SECRET_FILE = "testsecret.hex" TEST_PRIVATE_KEY = "cece4f25ac74deb1468965160c7185e07dff413f23fcadb611b05ca37ab0a52e" - TEST_TO_ADDRESS = "0x944fDcD1c868E3cC566C78023CcB38A32cDA836E" + TEST_TO_ADDRESS = "0x944fDcD1c868E3cC566C78023CcB38A32cDA836E" ) func setupTestRethEngine(t *testing.T) { @@ -120,7 +120,7 @@ func setupTestRethEngine(t *testing.T) { } func TestExecutionClientLifecycle(t *testing.T) { - // setupTestRethEngine(t) + setupTestRethEngine(t) genesisHash := common.HexToHash(GENESIS_HASH) @@ -157,7 +157,7 @@ func TestExecutionClientLifecycle(t *testing.T) { require.NoError(t, err) chainId, _ := new(big.Int).SetString(CHAIN_ID, 10) - nonce := uint64(0) + nonce := uint64(1) txnValue := big.NewInt(1000000000000000000) gasLimit := uint64(21000) gasPrice := big.NewInt(30000000000) @@ -173,6 +173,16 @@ func TestExecutionClientLifecycle(t *testing.T) { txs, err := executionClient.GetTxs() require.NoError(t, err) - assert.NotEmpty(t, txs) + assert.Equal(t, 1, len(txs)) + + txResp := types.Transaction{} + err = txResp.UnmarshalBinary(txs[0]) + require.NoError(t, err) + + assert.Equal(t, tx.Nonce(), txResp.Nonce()) + assert.Equal(t, tx.Value(), txResp.Value()) + assert.Equal(t, tx.To(), txResp.To()) + assert.Equal(t, tx.GasPrice(), txResp.GasPrice()) + assert.Equal(t, signedTx.ChainId(), txResp.ChainId()) }) } From 9d6a016e6689040de5a510d61b918e152789f480 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Tue, 12 Nov 2024 22:49:15 -0600 Subject: [PATCH 27/43] Add integration tests for evm api's --- docker/chain/genesis.json | 3 +- docker/docker-compose.yml | 4 +- execution.go | 3 +- integration_test.go | 86 +++++++++++++++++++++++++++------------ 4 files changed, 67 insertions(+), 29 deletions(-) diff --git a/docker/chain/genesis.json b/docker/chain/genesis.json index 1a0b9c0..6a7c548 100644 --- a/docker/chain/genesis.json +++ b/docker/chain/genesis.json @@ -10,7 +10,8 @@ "petersburgBlock": 0, "istanbulBlock": 0, "berlinBlock": 0, - "londonBlock": 0 + "londonBlock": 0, + "cancunTime": 1710338100 }, "alloc": { "0xd143C405751162d0F96bEE2eB5eb9C61882a736E": { diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 41710fb..70ae7a2 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -21,7 +21,7 @@ services: reth: container_name: reth restart: unless-stopped - image: ghcr.io/paradigmxyz/reth + image: ghcr.io/paradigmxyz/reth:v1.1.1 depends_on: jwt-init: condition: service_completed_successfully @@ -53,7 +53,7 @@ services: --http.api "eth,net,web3,txpool" \ --disable-discovery \ --debug.tip 0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216 \ - -vvvv + -vvvvv volumes: mainnet_data: diff --git a/execution.go b/execution.go index 52ce2b7..9059740 100644 --- a/execution.go +++ b/execution.go @@ -116,6 +116,7 @@ func (c *EngineAPIExecutionClient) Stop() { // InitChain initializes the blockchain with genesis information func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime time.Time, initialHeight uint64, chainID string) (execution_types.Hash, uint64, error) { var forkchoiceResult map[string]interface{} + err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", map[string]interface{}{ "headBlockHash": c.genesisHash, @@ -123,7 +124,7 @@ func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime ti "finalizedBlockHash": c.genesisHash, }, map[string]interface{}{ - "timestamp": genesisTime.Unix(), + "timestamp": fmt.Sprintf("0x%X", genesisTime.Unix()), "prevRandao": common.Hash{}, "suggestedFeeRecipient": c.feeRecipient, "parentBeaconBlockRoot": common.Hash{}, diff --git a/integration_test.go b/integration_test.go index 32e1bb9..7592afb 100644 --- a/integration_test.go +++ b/integration_test.go @@ -120,9 +120,14 @@ func setupTestRethEngine(t *testing.T) { } func TestExecutionClientLifecycle(t *testing.T) { - setupTestRethEngine(t) + // setupTestRethEngine(t) + initialHeight := uint64(0) genesisHash := common.HexToHash(GENESIS_HASH) + genesisTime := time.Now().UTC().Truncate(time.Second) + genesisStateroot := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") + var rollkitGenesisStateRoot rollkit_types.Hash + copy(rollkitGenesisStateRoot[:], genesisStateroot.Bytes()) rpcClient, err := ethclient.Dial(TEST_ETH_URL) require.NoError(t, err) @@ -137,41 +142,35 @@ func TestExecutionClientLifecycle(t *testing.T) { ) require.NoError(t, err) + // sub tests are only functional grouping. t.Run("InitChain", func(t *testing.T) { - genesisTime := time.Now().UTC().Truncate(time.Second) - initialHeight := uint64(0) - - stateRoot, gasLimit, err := executionClient.InitChain(genesisTime, initialHeight, CHAIN_ID) + stateRoot, gasLimit, err := executionClient.InitChain(context.Background(), genesisTime, initialHeight, CHAIN_ID) require.NoError(t, err) - staterootHash := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") - var expectedStateRoot rollkit_types.Hash - copy(expectedStateRoot[:], staterootHash.Bytes()) - - require.Equal(t, expectedStateRoot, stateRoot) + require.Equal(t, rollkitGenesisStateRoot, stateRoot) require.Equal(t, uint64(1000000), gasLimit) }) - t.Run("GetTxs", func(t *testing.T) { - privateKey, err := crypto.HexToECDSA(TEST_PRIVATE_KEY) - require.NoError(t, err) + privateKey, err := crypto.HexToECDSA(TEST_PRIVATE_KEY) + require.NoError(t, err) - chainId, _ := new(big.Int).SetString(CHAIN_ID, 10) - nonce := uint64(1) - txnValue := big.NewInt(1000000000000000000) - gasLimit := uint64(21000) - gasPrice := big.NewInt(30000000000) - toAddress := common.HexToAddress(TEST_TO_ADDRESS) + chainId, _ := new(big.Int).SetString(CHAIN_ID, 10) + nonce := uint64(1) + txValue := big.NewInt(1000000000000000000) + gasLimit := uint64(21000) + gasPrice := big.NewInt(30000000000) + toAddress := common.HexToAddress(TEST_TO_ADDRESS) - tx := types.NewTransaction(nonce, toAddress, txnValue, gasLimit, gasPrice, nil) + tx := types.NewTransaction(nonce, toAddress, txValue, gasLimit, gasPrice, nil) - signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainId), privateKey) - require.NoError(t, err) + signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainId), privateKey) + require.NoError(t, err) - err = rpcClient.SendTransaction(context.Background(), signedTx) - require.NoError(t, err) + err = rpcClient.SendTransaction(context.Background(), signedTx) + require.NoError(t, err) - txs, err := executionClient.GetTxs() + t.Run("GetTxs", func(t *testing.T) { + txs, err := executionClient.GetTxs(context.Background()) require.NoError(t, err) assert.Equal(t, 1, len(txs)) @@ -185,4 +184,41 @@ func TestExecutionClientLifecycle(t *testing.T) { assert.Equal(t, tx.GasPrice(), txResp.GasPrice()) assert.Equal(t, signedTx.ChainId(), txResp.ChainId()) }) + + txBytes, err := tx.MarshalBinary() + require.NoError(t, err) + + t.Run("ExecuteTxs", func(t *testing.T) { + newStateroot := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") + var rollkitNewStateRoot rollkit_types.Hash + copy(rollkitNewStateRoot[:], newStateroot.Bytes()) + + stateroot, gasUsed, err := executionClient.ExecuteTxs(context.Background(), []rollkit_types.Tx{rollkit_types.Tx(txBytes)}, initialHeight, genesisTime, rollkitGenesisStateRoot) + require.NoError(t, err) + assert.Greater(t, gasLimit, gasUsed) + assert.Equal(t, newStateroot, stateroot) + }) } + +func TestExecutionClient_InvalidPayloadTimestamp(t *testing.T) { + setupTestRethEngine(t) + + initialHeight := uint64(0) + genesisHash := common.HexToHash(GENESIS_HASH) + genesisTime := time.Date(2024,3, 13, 13, 54, 0, 0, time.UTC)// pre-cancun timestamp not supported + + executionClient, err := NewEngineAPIExecutionClient( + &proxy_json_rpc.Config{}, + TEST_ETH_URL, + TEST_ENGINE_URL, + JWT_SECRET, + genesisHash, + common.Address{}, + ) + require.NoError(t, err) + + _, _, err = executionClient.InitChain(context.Background(), genesisTime, initialHeight, CHAIN_ID) + // payload timestamp is not within the cancun timestamp + require.Error(t, err) + require.ErrorContains(t, err, "Unsupported fork") +} \ No newline at end of file From 4577d1fe11ea38dd4fef34ec237c0443f35af709 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Thu, 14 Nov 2024 09:36:44 -0600 Subject: [PATCH 28/43] fix mandatory field validation for payload creation --- docker/chain/genesis.json | 1 + execution.go | 47 ++++++++++++++++++++++++++------------- integration_test.go | 10 +++++---- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/docker/chain/genesis.json b/docker/chain/genesis.json index 6a7c548..61ba9d0 100644 --- a/docker/chain/genesis.json +++ b/docker/chain/genesis.json @@ -11,6 +11,7 @@ "istanbulBlock": 0, "berlinBlock": 0, "londonBlock": 0, + "shanghaiTime": 1677557088, "cancunTime": 1710338100 }, "alloc": { diff --git a/execution.go b/execution.go index 9059740..fea3a27 100644 --- a/execution.go +++ b/execution.go @@ -116,7 +116,7 @@ func (c *EngineAPIExecutionClient) Stop() { // InitChain initializes the blockchain with genesis information func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime time.Time, initialHeight uint64, chainID string) (execution_types.Hash, uint64, error) { var forkchoiceResult map[string]interface{} - + err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", map[string]interface{}{ "headBlockHash": c.genesisHash, @@ -147,13 +147,12 @@ func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime ti executionPayload := payloadResult["executionPayload"].(map[string]interface{}) stateRoot := common.HexToHash(executionPayload["stateRoot"].(string)) + rollkitStateRoot := execution_types.Hash(stateRoot[:]) gasLimitHex := executionPayload["gasLimit"].(string) gasLimit := new(big.Int) gasLimit.SetString(gasLimitHex[2:], 16) - var rollkitStateRoot execution_types.Hash - copy(rollkitStateRoot[:], stateRoot[:]) return rollkitStateRoot, gasLimit.Uint64(), nil } @@ -196,23 +195,41 @@ func (c *EngineAPIExecutionClient) GetTxs(ctx context.Context) ([]execution_type // ExecuteTxs executes the given transactions and returns the new state root and gas used func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []execution_types.Tx, height uint64, timestamp time.Time, prevStateRoot execution_types.Hash) (execution_types.Hash, uint64, error) { - ethTxs := make([][]byte, len(txs)) + ethTxs := make([]string, len(txs)) for i, tx := range txs { - ethTxs[i] = tx + ethTxs[i] = common.Bytes2Hex(tx) } var newPayloadResult map[string]interface{} - err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", map[string]interface{}{ - "parentHash": common.BytesToHash(prevStateRoot[:]), - "timestamp": timestamp.Unix(), - "prevRandao": c.derivePrevRandao(height), - "feeRecipient": c.feeRecipient, - "transactions": ethTxs, - "expectedBlobVersionedHashes": []string{}, - "parentBeaconBlockRoot": common.Hash{}, - }) + err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", + map[string]interface{}{ + "stateRoot": prevStateRoot.String(), + "parentHash": common.BytesToHash(prevStateRoot[:]), + "timestamp": fmt.Sprintf("0x%X", timestamp.Unix()), + "prevRandao": c.derivePrevRandao(height), + "feeRecipient": c.feeRecipient, + "transactions": ethTxs, + "blobGasUsed": "0x00", + "excessBlobGas": "0x00", + "withdrawals": types.Withdrawals{}, + "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockNumber": fmt.Sprintf("0x%X", height), + "gasLimit": "0xf4240", + "gasUsed": "0x5208", + "extraData": "0x", + "baseFeePerGas": "0x7", + "blockHash": "0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858", // TODO + }, + // Expected blob versioned hashes + []string{ + "0x000657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014", + }, + // Root of the parent beacon block + "0x169630f535b4a41330164c6e5c92b1224c0c407f582d407d0ac3d206cd32fd52", + ) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %s", err.Error()) } status, ok := newPayloadResult["status"].(string) diff --git a/integration_test.go b/integration_test.go index 7592afb..96ee758 100644 --- a/integration_test.go +++ b/integration_test.go @@ -126,8 +126,7 @@ func TestExecutionClientLifecycle(t *testing.T) { genesisHash := common.HexToHash(GENESIS_HASH) genesisTime := time.Now().UTC().Truncate(time.Second) genesisStateroot := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") - var rollkitGenesisStateRoot rollkit_types.Hash - copy(rollkitGenesisStateRoot[:], genesisStateroot.Bytes()) + rollkitGenesisStateRoot := rollkit_types.Hash(genesisStateroot[:]) rpcClient, err := ethclient.Dial(TEST_ETH_URL) require.NoError(t, err) @@ -188,19 +187,22 @@ func TestExecutionClientLifecycle(t *testing.T) { txBytes, err := tx.MarshalBinary() require.NoError(t, err) + blockHeight := uint64(1) + blockTime := genesisTime.Add(10 * time.Second) + t.Run("ExecuteTxs", func(t *testing.T) { newStateroot := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") var rollkitNewStateRoot rollkit_types.Hash copy(rollkitNewStateRoot[:], newStateroot.Bytes()) - stateroot, gasUsed, err := executionClient.ExecuteTxs(context.Background(), []rollkit_types.Tx{rollkit_types.Tx(txBytes)}, initialHeight, genesisTime, rollkitGenesisStateRoot) + stateroot, gasUsed, err := executionClient.ExecuteTxs(context.Background(), []rollkit_types.Tx{rollkit_types.Tx(txBytes)}, blockHeight, blockTime, rollkitGenesisStateRoot) require.NoError(t, err) assert.Greater(t, gasLimit, gasUsed) assert.Equal(t, newStateroot, stateroot) }) } -func TestExecutionClient_InvalidPayloadTimestamp(t *testing.T) { +func TestExecutionClient_InitChain_InvalidPayloadTimestamp(t *testing.T) { setupTestRethEngine(t) initialHeight := uint64(0) From a456a099257014cf4d903e04b8aa58f0d09a9fe1 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Thu, 14 Nov 2024 16:14:41 -0600 Subject: [PATCH 29/43] send signed transaction to execution layer client --- execution.go | 12 ++++++++---- integration_test.go | 27 ++++++++++++++++----------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/execution.go b/execution.go index fea3a27..59ed765 100644 --- a/execution.go +++ b/execution.go @@ -128,6 +128,7 @@ func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime ti "prevRandao": common.Hash{}, "suggestedFeeRecipient": c.feeRecipient, "parentBeaconBlockRoot": common.Hash{}, + "withdrawals": []struct{}{}, }, ) if err != nil { @@ -200,6 +201,9 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi ethTxs[i] = common.Bytes2Hex(tx) } + // todo: fix + blkHash := "0x5971982f5f6e01257226780fcdc571e5b3844cac6e91ab2b423152248c585cb0" + var newPayloadResult map[string]interface{} err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", map[string]interface{}{ @@ -211,7 +215,7 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi "transactions": ethTxs, "blobGasUsed": "0x00", "excessBlobGas": "0x00", - "withdrawals": types.Withdrawals{}, + "withdrawals": []struct{}{}, "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "blockNumber": fmt.Sprintf("0x%X", height), @@ -219,14 +223,14 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi "gasUsed": "0x5208", "extraData": "0x", "baseFeePerGas": "0x7", - "blockHash": "0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858", // TODO + "blockHash": blkHash, }, // Expected blob versioned hashes []string{ - "0x000657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014", + "0x0000000000000000000000000000000000000000000000000000000000000000", }, // Root of the parent beacon block - "0x169630f535b4a41330164c6e5c92b1224c0c407f582d407d0ac3d206cd32fd52", + c.genesisHash.String(), ) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %s", err.Error()) diff --git a/integration_test.go b/integration_test.go index 96ee758..0c5db6f 100644 --- a/integration_test.go +++ b/integration_test.go @@ -128,7 +128,7 @@ func TestExecutionClientLifecycle(t *testing.T) { genesisStateroot := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") rollkitGenesisStateRoot := rollkit_types.Hash(genesisStateroot[:]) - rpcClient, err := ethclient.Dial(TEST_ETH_URL) + _, err := ethclient.Dial(TEST_ETH_URL) require.NoError(t, err) executionClient, err := NewEngineAPIExecutionClient( @@ -165,8 +165,10 @@ func TestExecutionClientLifecycle(t *testing.T) { signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainId), privateKey) require.NoError(t, err) - err = rpcClient.SendTransaction(context.Background(), signedTx) - require.NoError(t, err) + rSignedTx, sSignedTx, vSignedTx := signedTx.RawSignatureValues() + + // err = rpcClient.SendTransaction(context.Background(), signedTx) + // require.NoError(t, err) t.Run("GetTxs", func(t *testing.T) { txs, err := executionClient.GetTxs(context.Background()) @@ -177,14 +179,17 @@ func TestExecutionClientLifecycle(t *testing.T) { err = txResp.UnmarshalBinary(txs[0]) require.NoError(t, err) - assert.Equal(t, tx.Nonce(), txResp.Nonce()) - assert.Equal(t, tx.Value(), txResp.Value()) - assert.Equal(t, tx.To(), txResp.To()) - assert.Equal(t, tx.GasPrice(), txResp.GasPrice()) - assert.Equal(t, signedTx.ChainId(), txResp.ChainId()) + assert.Equal(t, signedTx.Nonce(), txResp.Nonce()) + assert.Equal(t, signedTx.Value(), txResp.Value()) + assert.Equal(t, signedTx.To(), txResp.To()) + assert.Equal(t, signedTx.GasPrice(), txResp.GasPrice()) + r, s, v := txResp.RawSignatureValues() + assert.Equal(t, rSignedTx, r) + assert.Equal(t, sSignedTx, s) + assert.Equal(t, vSignedTx, v) }) - txBytes, err := tx.MarshalBinary() + txBytes, err := signedTx.MarshalBinary() require.NoError(t, err) blockHeight := uint64(1) @@ -207,7 +212,7 @@ func TestExecutionClient_InitChain_InvalidPayloadTimestamp(t *testing.T) { initialHeight := uint64(0) genesisHash := common.HexToHash(GENESIS_HASH) - genesisTime := time.Date(2024,3, 13, 13, 54, 0, 0, time.UTC)// pre-cancun timestamp not supported + genesisTime := time.Date(2024, 3, 13, 13, 54, 0, 0, time.UTC) // pre-cancun timestamp not supported executionClient, err := NewEngineAPIExecutionClient( &proxy_json_rpc.Config{}, @@ -223,4 +228,4 @@ func TestExecutionClient_InitChain_InvalidPayloadTimestamp(t *testing.T) { // payload timestamp is not within the cancun timestamp require.Error(t, err) require.ErrorContains(t, err, "Unsupported fork") -} \ No newline at end of file +} From a64658d8ecb87efb7010843ec10afd71e2301a11 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Thu, 14 Nov 2024 15:01:02 -0800 Subject: [PATCH 30/43] feat: add proper jwt auth in engine api calls --- execution.go | 40 ++++++++++++++++++++++++++++++++++++++-- execution_test.go | 20 ++++++++++++++++++++ go.mod | 1 + go.sum | 2 ++ 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/execution.go b/execution.go index 034de81..7e99706 100644 --- a/execution.go +++ b/execution.go @@ -5,12 +5,16 @@ import ( "errors" "fmt" "math/big" + "net/http" "time" + "encoding/hex" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" + "github.com/golang-jwt/jwt/v5" execution "github.com/rollkit/go-execution" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" execution_types "github.com/rollkit/go-execution/types" @@ -42,7 +46,14 @@ type EngineAPIExecutionClient struct { } // NewEngineAPIExecutionClient creates a new instance of EngineAPIExecutionClient -func NewEngineAPIExecutionClient(proxyConfig *proxy_json_rpc.Config, ethURL, engineURL string, genesisHash common.Hash, feeRecipient common.Address) (*EngineAPIExecutionClient, error) { +func NewEngineAPIExecutionClient( + proxyConfig *proxy_json_rpc.Config, + ethURL, + engineURL string, + jwtSecret string, + genesisHash common.Hash, + feeRecipient common.Address, +) (*EngineAPIExecutionClient, error) { proxyClient := proxy_json_rpc.NewClient() proxyClient.SetConfig(proxyConfig) @@ -51,8 +62,33 @@ func NewEngineAPIExecutionClient(proxyConfig *proxy_json_rpc.Config, ethURL, eng return nil, err } - engineClient, err := rpc.Dial(engineURL) + authToken := "" + if jwtSecret != "" { + secret, err := hex.DecodeString(jwtSecret) + if err != nil { + return nil, err + } + + token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ + "exp": time.Now().Add(time.Hour * 1).Unix(), // Expires in 1 hour + "iat": time.Now().Unix(), + }) + + authToken, err = token.SignedString(secret) + if err != nil { + return nil, err + } + } + + engineClient, err := rpc.DialOptions(context.Background(), engineURL, + rpc.WithHTTPAuth(func(h http.Header) error { + if authToken != "" { + h.Set("Authorization", "Bearer "+authToken) + } + return nil + })) if err != nil { + ethClient.Close() // Clean up eth client if engine client fails return nil, err } diff --git a/execution_test.go b/execution_test.go index 8ee86ea..861640f 100644 --- a/execution_test.go +++ b/execution_test.go @@ -9,6 +9,8 @@ import ( "testing" "time" + "encoding/hex" + "github.com/ethereum/go-ethereum/common" "github.com/rollkit/go-execution-evm/mocks" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" @@ -16,6 +18,16 @@ import ( "github.com/stretchr/testify/require" ) +// Helper function to generate a test JWT secret +func generateTestJWTSecret() string { + // Generate a random 32-byte hex string for testing + secret := make([]byte, 32) + for i := range secret { + secret[i] = byte(i) + } + return hex.EncodeToString(secret) +} + func TestEngineAPIExecutionClient_InitChain(t *testing.T) { mockEngine := mocks.NewMockEngineAPI(t) defer mockEngine.Close() @@ -23,10 +35,12 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { mockEth := mocks.NewMockEthAPI(t) defer mockEth.Close() + jwtSecret := generateTestJWTSecret() client, err := NewEngineAPIExecutionClient( &proxy_json_rpc.Config{}, mockEth.URL, mockEngine.URL, + jwtSecret, common.Hash{}, common.Address{}, ) @@ -61,10 +75,12 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { mockEth := mocks.NewMockEthAPI(t) defer mockEth.Close() + jwtSecret := generateTestJWTSecret() client, err := NewEngineAPIExecutionClient( &proxy_json_rpc.Config{}, mockEth.URL, mockEngine.URL, + jwtSecret, common.Hash{}, common.Address{}, ) @@ -109,10 +125,12 @@ func TestEngineAPIExecutionClient_GetTxs(t *testing.T) { mockEth := mocks.NewMockEthAPI(t) defer mockEth.Close() + jwtSecret := generateTestJWTSecret() client, err := NewEngineAPIExecutionClient( &proxy_json_rpc.Config{}, mockEth.URL, mockEngine.URL, + jwtSecret, common.Hash{}, common.Address{}, ) @@ -175,10 +193,12 @@ func TestEngineAPIExecutionClient_SetFinal(t *testing.T) { mockEth := mocks.NewMockEthAPI(t) defer mockEth.Close() + jwtSecret := generateTestJWTSecret() client, err := NewEngineAPIExecutionClient( &proxy_json_rpc.Config{}, mockEth.URL, mockEngine.URL, + jwtSecret, common.Hash{}, common.Address{}, ) diff --git a/go.mod b/go.mod index be8ee4d..17bcb8f 100644 --- a/go.mod +++ b/go.mod @@ -29,6 +29,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect diff --git a/go.sum b/go.sum index 81916d3..09e37a5 100644 --- a/go.sum +++ b/go.sum @@ -93,6 +93,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= From fff67cf0547e1fd90bc755fbe4134ec34cd0b6a2 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Thu, 14 Nov 2024 17:36:50 -0800 Subject: [PATCH 31/43] refactor: use more concrete types for building engine api payloads --- execution.go | 128 ++++++++++++++++++++++----------------------------- go.mod | 6 ++- types.go | 60 ++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 76 deletions(-) create mode 100644 types.go diff --git a/execution.go b/execution.go index 7e99706..72814fa 100644 --- a/execution.go +++ b/execution.go @@ -6,6 +6,7 @@ import ( "fmt" "math/big" "net/http" + "strings" "time" "encoding/hex" @@ -20,14 +21,6 @@ import ( execution_types "github.com/rollkit/go-execution/types" ) -type PayloadStatus string - -const ( - PayloadStatusValid PayloadStatus = "VALID" - PayloadStatusInvalid PayloadStatus = "INVALID" - PayloadStatusSyncing PayloadStatus = "SYNCING" -) - var ( ErrNilPayloadStatus = errors.New("nil payload status") ErrInvalidPayloadStatus = errors.New("invalid payload status") @@ -121,41 +114,37 @@ func (c *EngineAPIExecutionClient) Stop() { // InitChain initializes the blockchain with genesis information func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime time.Time, initialHeight uint64, chainID string) (execution_types.Hash, uint64, error) { - var forkchoiceResult map[string]interface{} + var forkchoiceResult ForkchoiceUpdatedResponse err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", - map[string]interface{}{ - "headBlockHash": c.genesisHash, - "safeBlockHash": c.genesisHash, - "finalizedBlockHash": c.genesisHash, + ForkchoiceState{ + HeadBlockHash: c.genesisHash, + SafeBlockHash: c.genesisHash, + FinalizedBlockHash: c.genesisHash, }, - map[string]interface{}{ - "timestamp": genesisTime.Unix(), - "prevRandao": common.Hash{}, - "suggestedFeeRecipient": c.feeRecipient, - "parentBeaconBlockRoot": common.Hash{}, + PayloadAttributes{ + Timestamp: genesisTime.Unix(), + PrevRandao: common.Hash{}, + SuggestedFeeRecipient: c.feeRecipient, + ParentBeaconBlockRoot: common.Hash{}, }, ) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV3 failed: %w", err) } - payloadID, ok := forkchoiceResult["payloadId"].(string) - if !ok { + if forkchoiceResult.PayloadID == nil { return execution_types.Hash{}, 0, ErrNilPayloadStatus } - var payloadResult map[string]interface{} - err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", payloadID) + var payloadResult PayloadResponse + err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", *forkchoiceResult.PayloadID) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV3 failed: %w", err) } - executionPayload := payloadResult["executionPayload"].(map[string]interface{}) - stateRoot := common.HexToHash(executionPayload["stateRoot"].(string)) - - gasLimitHex := executionPayload["gasLimit"].(string) + stateRoot := common.HexToHash(payloadResult.ExecutionPayload.StateRoot) gasLimit := new(big.Int) - gasLimit.SetString(gasLimitHex[2:], 16) + gasLimit.SetString(strings.TrimPrefix(payloadResult.ExecutionPayload.GasLimit, "0x"), 16) var rollkitStateRoot execution_types.Hash copy(rollkitStateRoot[:], stateRoot[:]) @@ -206,62 +195,59 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi ethTxs[i] = tx } - var newPayloadResult map[string]interface{} - err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", map[string]interface{}{ - "parentHash": common.BytesToHash(prevStateRoot[:]), - "timestamp": timestamp.Unix(), - "prevRandao": c.derivePrevRandao(height), - "feeRecipient": c.feeRecipient, - "transactions": ethTxs, - "expectedBlobVersionedHashes": []string{}, - "parentBeaconBlockRoot": common.Hash{}, - }) + var newPayloadResult struct { + Status PayloadStatus `json:"status"` + } + err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", + NewPayloadRequest{ + ParentHash: common.BytesToHash(prevStateRoot[:]), + Timestamp: timestamp.Unix(), + PrevRandao: c.derivePrevRandao(height), + FeeRecipient: c.feeRecipient, + Transactions: ethTxs, + ExpectedBlobVersionedHashes: []string{}, + ParentBeaconBlockRoot: common.Hash{}, + }, + ) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %w", err) } - status, ok := newPayloadResult["status"].(string) - if !ok || PayloadStatus(status) != PayloadStatusValid { + if newPayloadResult.Status != PayloadStatusValid { return execution_types.Hash{}, 0, ErrInvalidPayloadStatus } - // update fork choice - var forkchoiceResult map[string]interface{} + var forkchoiceResult ForkchoiceUpdatedResponse err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", - map[string]interface{}{ - "headBlockHash": common.BytesToHash(prevStateRoot[:]), - "safeBlockHash": common.BytesToHash(prevStateRoot[:]), - "finalizedBlockHash": common.BytesToHash(prevStateRoot[:]), + ForkchoiceState{ + HeadBlockHash: common.BytesToHash(prevStateRoot[:]), + SafeBlockHash: common.BytesToHash(prevStateRoot[:]), + FinalizedBlockHash: common.BytesToHash(prevStateRoot[:]), }, - map[string]interface{}{ - "timestamp": timestamp.Unix(), - "prevRandao": c.derivePrevRandao(height), - "suggestedFeeRecipient": c.feeRecipient, - "parentBeaconBlockRoot": common.Hash{}, + PayloadAttributes{ + Timestamp: timestamp.Unix(), + PrevRandao: c.derivePrevRandao(height), + SuggestedFeeRecipient: c.feeRecipient, + ParentBeaconBlockRoot: common.Hash{}, }, ) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV3 failed: %w", err) } - // get the execution results - var payloadResult map[string]interface{} - payloadID, ok := forkchoiceResult["payloadId"].(string) - if !ok { + if forkchoiceResult.PayloadID == nil { return execution_types.Hash{}, 0, ErrNilPayloadStatus } - err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", payloadID) + var payloadResult PayloadResponse + err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", *forkchoiceResult.PayloadID) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV3 failed: %w", err) } - executionPayload := payloadResult["executionPayload"].(map[string]interface{}) - newStateRoot := common.HexToHash(executionPayload["stateRoot"].(string)) - - gasUsedHex := executionPayload["gasUsed"].(string) + newStateRoot := common.HexToHash(payloadResult.ExecutionPayload.StateRoot) gasUsed := new(big.Int) - gasUsed.SetString(gasUsedHex[2:], 16) + gasUsed.SetString(strings.TrimPrefix(payloadResult.ExecutionPayload.GasUsed, "0x"), 16) var rollkitNewStateRoot execution_types.Hash copy(rollkitNewStateRoot[:], newStateRoot[:]) @@ -275,28 +261,22 @@ func (c *EngineAPIExecutionClient) SetFinal(ctx context.Context, height uint64) return fmt.Errorf("failed to get block at height %d: %w", height, err) } - var forkchoiceResult map[string]interface{} + var forkchoiceResult ForkchoiceUpdatedResponse err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", - map[string]interface{}{ - "headBlockHash": block.Hash(), - "safeBlockHash": block.Hash(), - "finalizedBlockHash": block.Hash(), + ForkchoiceState{ + HeadBlockHash: block.Hash(), + SafeBlockHash: block.Hash(), + FinalizedBlockHash: block.Hash(), }, - map[string]interface{}{ - "parentBeaconBlockRoot": common.Hash{}, + PayloadAttributes{ + ParentBeaconBlockRoot: common.Hash{}, }, ) if err != nil { return fmt.Errorf("engine_forkchoiceUpdatedV3 failed for finalization: %w", err) } - payloadStatus, ok := forkchoiceResult["payloadStatus"].(map[string]interface{}) - if !ok { - return ErrNilPayloadStatus - } - - status, ok := payloadStatus["status"].(string) - if !ok || PayloadStatus(status) != PayloadStatusValid { + if forkchoiceResult.PayloadStatus.Status != PayloadStatusValid { return ErrInvalidPayloadStatus } diff --git a/go.mod b/go.mod index 17bcb8f..e245104 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,6 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect @@ -76,4 +75,7 @@ require ( rsc.io/tmplfunc v0.0.3 // indirect ) -require github.com/stretchr/testify v1.9.0 +require ( + github.com/golang-jwt/jwt/v5 v5.2.1 + github.com/stretchr/testify v1.9.0 +) diff --git a/types.go b/types.go new file mode 100644 index 0000000..d50dce8 --- /dev/null +++ b/types.go @@ -0,0 +1,60 @@ +package execution + +import ( + "github.com/ethereum/go-ethereum/common" +) + +type PayloadStatus string + +const ( + PayloadStatusValid PayloadStatus = "VALID" + PayloadStatusInvalid PayloadStatus = "INVALID" + PayloadStatusSyncing PayloadStatus = "SYNCING" +) + +// ForkchoiceUpdatedResponse represents the response from engine_forkchoiceUpdatedV3 +type ForkchoiceUpdatedResponse struct { + PayloadStatus struct { + Status PayloadStatus `json:"status"` + ValidationError *string `json:"validationError,omitempty"` + } `json:"payloadStatus"` + PayloadID *string `json:"payloadId,omitempty"` +} + +// ExecutionPayload represents the payload data from the execution client +type ExecutionPayload struct { + StateRoot string `json:"stateRoot"` + GasUsed string `json:"gasUsed"` + GasLimit string `json:"gasLimit"` +} + +// PayloadResponse represents the response from engine_getPayloadV3 +type PayloadResponse struct { + ExecutionPayload ExecutionPayload `json:"executionPayload"` +} + +// ForkchoiceState represents the forkchoice state for engine API calls +type ForkchoiceState struct { + HeadBlockHash common.Hash `json:"headBlockHash"` + SafeBlockHash common.Hash `json:"safeBlockHash"` + FinalizedBlockHash common.Hash `json:"finalizedBlockHash"` +} + +// PayloadAttributes represents the payload attributes for engine API calls +type PayloadAttributes struct { + Timestamp int64 `json:"timestamp"` + PrevRandao common.Hash `json:"prevRandao"` + SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient"` + ParentBeaconBlockRoot common.Hash `json:"parentBeaconBlockRoot"` +} + +// NewPayloadRequest represents the request parameters for engine_newPayloadV3 +type NewPayloadRequest struct { + ParentHash common.Hash `json:"parentHash"` + Timestamp int64 `json:"timestamp"` + PrevRandao common.Hash `json:"prevRandao"` + FeeRecipient common.Address `json:"feeRecipient"` + Transactions [][]byte `json:"transactions"` + ExpectedBlobVersionedHashes []string `json:"expectedBlobVersionedHashes"` + ParentBeaconBlockRoot common.Hash `json:"parentBeaconBlockRoot"` +} From 00a5fa79c3ab4afae46a6876207b46113e35beb9 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Sat, 16 Nov 2024 11:35:47 -0600 Subject: [PATCH 32/43] fix blockhash for block proposal --- execution.go | 84 +++++++++++++++++++++++++++++++++------------ go.mod | 26 +++++++++++++- go.sum | 48 ++++++++++++++++++++++++++ integration_test.go | 14 ++++---- 4 files changed, 143 insertions(+), 29 deletions(-) diff --git a/execution.go b/execution.go index 59ed765..f4928a2 100644 --- a/execution.go +++ b/execution.go @@ -1,6 +1,7 @@ package execution import ( + "bytes" "context" "encoding/hex" "errors" @@ -10,10 +11,13 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/trie" "github.com/golang-jwt/jwt" + execution "github.com/rollkit/go-execution" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" execution_types "github.com/rollkit/go-execution/types" @@ -196,41 +200,79 @@ func (c *EngineAPIExecutionClient) GetTxs(ctx context.Context) ([]execution_type // ExecuteTxs executes the given transactions and returns the new state root and gas used func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []execution_types.Tx, height uint64, timestamp time.Time, prevStateRoot execution_types.Hash) (execution_types.Hash, uint64, error) { - ethTxs := make([]string, len(txs)) + ethTxs := make([]*types.Transaction, len(txs)) for i, tx := range txs { - ethTxs[i] = common.Bytes2Hex(tx) + ethTxs[i] = new(types.Transaction) + err := ethTxs[i].UnmarshalBinary(tx) + if err != nil { + return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %s", err.Error()) + } + } + + txsPayload := make([]string, len(txs)) + for i, tx := range ethTxs { + buf := bytes.Buffer{} + err := tx.EncodeRLP(&buf) + if err != nil { + return execution_types.Hash{}, 0, fmt.Errorf("error RLP encoding tx: %s", err.Error()) + } + + txsPayload[i] = fmt.Sprintf("0x%x", buf.Bytes()) + } + + blockHeader := types.Header{ + Root: common.Hash(prevStateRoot), + ParentHash: common.BytesToHash(prevStateRoot[:]), + UncleHash: types.EmptyUncleHash, + Time: uint64(1731729558), // timestamp.Unix + Coinbase: c.feeRecipient, + MixDigest: c.derivePrevRandao(height), + BlobGasUsed: new(uint64), + ExcessBlobGas: new(uint64), + ReceiptHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), + Bloom: types.Bloom{}, + Number: big.NewInt(int64(height)), + GasLimit: 30000000, + GasUsed: 20000000, + Extra: hexutil.Bytes("0x"), + BaseFee: big.NewInt(7), + TxHash: types.DeriveSha(types.Transactions(ethTxs), trie.NewStackTrie(nil)), + Difficulty: big.NewInt(0), + Nonce: types.BlockNonce{}, } - // todo: fix - blkHash := "0x5971982f5f6e01257226780fcdc571e5b3844cac6e91ab2b423152248c585cb0" + logsBloomStr, err := blockHeader.Bloom.MarshalText() + if err != nil { + return execution_types.Hash{}, 0, fmt.Errorf("invalid logs bloom: %w", err) + } var newPayloadResult map[string]interface{} - err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", + err = c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", map[string]interface{}{ - "stateRoot": prevStateRoot.String(), - "parentHash": common.BytesToHash(prevStateRoot[:]), - "timestamp": fmt.Sprintf("0x%X", timestamp.Unix()), - "prevRandao": c.derivePrevRandao(height), - "feeRecipient": c.feeRecipient, - "transactions": ethTxs, - "blobGasUsed": "0x00", - "excessBlobGas": "0x00", + "stateRoot": blockHeader.Root.Hex(), + "parentHash": blockHeader.ParentHash.Hex(), + "timestamp": hexutil.EncodeUint64(blockHeader.Time), + "prevRandao": blockHeader.MixDigest.Hex(), + "feeRecipient": blockHeader.Coinbase.Hex(), + "transactions": txsPayload, + "blobGasUsed": hexutil.EncodeUint64(*blockHeader.BlobGasUsed), + "excessBlobGas": hexutil.EncodeUint64(*blockHeader.ExcessBlobGas), "withdrawals": []struct{}{}, - "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockNumber": fmt.Sprintf("0x%X", height), - "gasLimit": "0xf4240", - "gasUsed": "0x5208", + "receiptsRoot": blockHeader.ReceiptHash.Hex(), + "logsBloom": string(logsBloomStr), + "blockNumber": hexutil.EncodeBig(blockHeader.Number), + "gasLimit": hexutil.EncodeUint64(blockHeader.GasLimit), + "gasUsed": hexutil.EncodeUint64(blockHeader.GasUsed), "extraData": "0x", - "baseFeePerGas": "0x7", - "blockHash": blkHash, + "baseFeePerGas": hexutil.EncodeBig(blockHeader.BaseFee), + "blockHash": blockHeader.Hash().Hex(), // Keccak256(RLP(ExecutionBlockHeader)) }, // Expected blob versioned hashes []string{ "0x0000000000000000000000000000000000000000000000000000000000000000", }, // Root of the parent beacon block - c.genesisHash.String(), + c.genesisHash.Hex(), ) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %s", err.Error()) diff --git a/go.mod b/go.mod index 241028b..0eb4ffa 100644 --- a/go.mod +++ b/go.mod @@ -10,12 +10,21 @@ require ( ) require ( + github.com/DataDog/zstd v1.4.5 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/StackExchange/wmi v1.2.1 // indirect + github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect github.com/celestiaorg/go-header v0.6.3 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cockroachdb/errors v1.11.3 // indirect + github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v1.1.2 // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect @@ -32,17 +41,23 @@ require ( github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/getsentry/sentry-go v0.27.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect + github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/holiman/uint256 v1.3.1 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect + github.com/klauspost/compress v1.17.8 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-libp2p v0.35.0 // indirect github.com/libp2p/go-libp2p-pubsub v0.11.0 // indirect @@ -63,14 +78,22 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.48.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.11.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/supranational/blst v0.3.13 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect @@ -81,8 +104,9 @@ require ( go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect - golang.org/x/sync v0.7.0 // indirect + golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index d78d18a..c371dff 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,7 @@ github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLR github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -82,6 +83,8 @@ github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= @@ -108,8 +111,19 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= @@ -131,6 +145,7 @@ github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZ github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= @@ -191,6 +206,7 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4= @@ -237,10 +253,16 @@ github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= @@ -281,6 +303,7 @@ github.com/pion/turn/v2 v2.1.6 h1:Xr2niVsiPTB0FPtt+yAWKFUkU1eotQbGgpTIld4x1Gc= github.com/pion/turn/v2 v2.1.6/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY= github.com/pion/webrtc/v3 v3.2.40 h1:Wtfi6AZMQg+624cvCXUuSmrKWepSB7zfgYDOYqsSOVU= github.com/pion/webrtc/v3 v3.2.40/go.mod h1:M1RAe3TNTD1tzyvqHrbVODfwdPGSXOUo/OgpoGGJqFY= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -305,6 +328,7 @@ github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtB github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= @@ -379,23 +403,36 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -410,6 +447,7 @@ golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= @@ -427,15 +465,25 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/integration_test.go b/integration_test.go index 0c5db6f..e95487a 100644 --- a/integration_test.go +++ b/integration_test.go @@ -25,17 +25,17 @@ import ( const ( TEST_ETH_URL = "http://localhost:8545" TEST_ENGINE_URL = "http://localhost:8551" + JWT_SECRET = "09a23c010d96caaebb21c193b85d30bbb62a9bac5bd0a684e9e91c77c811ca65" - CHAIN_ID = "1234" - GENESIS_HASH = "0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216" - JWT_SECRET = "09a23c010d96caaebb21c193b85d30bbb62a9bac5bd0a684e9e91c77c811ca65" + CHAIN_ID = "1234" + GENESIS_HASH = "0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216" + GENESIS_STATEROOT = "0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4" + TEST_PRIVATE_KEY = "cece4f25ac74deb1468965160c7185e07dff413f23fcadb611b05ca37ab0a52e" + TEST_TO_ADDRESS = "0x944fDcD1c868E3cC566C78023CcB38A32cDA836E" DOCKER_CHAIN_PATH = "./docker/chain" // path relative to the test file DOCKER_JWTSECRET_PATH = "./docker/jwttoken/" // path relative to the test file DOCKER_JWT_SECRET_FILE = "testsecret.hex" - - TEST_PRIVATE_KEY = "cece4f25ac74deb1468965160c7185e07dff413f23fcadb611b05ca37ab0a52e" - TEST_TO_ADDRESS = "0x944fDcD1c868E3cC566C78023CcB38A32cDA836E" ) func setupTestRethEngine(t *testing.T) { @@ -125,7 +125,7 @@ func TestExecutionClientLifecycle(t *testing.T) { initialHeight := uint64(0) genesisHash := common.HexToHash(GENESIS_HASH) genesisTime := time.Now().UTC().Truncate(time.Second) - genesisStateroot := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") + genesisStateroot := common.HexToHash(GENESIS_STATEROOT) rollkitGenesisStateRoot := rollkit_types.Hash(genesisStateroot[:]) _, err := ethclient.Dial(TEST_ETH_URL) From fe309e1058af6555722532f3cde049b6b76323b8 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Mon, 18 Nov 2024 15:47:19 -0600 Subject: [PATCH 33/43] upgrade reth version for integration tests --- integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_test.go b/integration_test.go index e95487a..f6722bb 100644 --- a/integration_test.go +++ b/integration_test.go @@ -55,7 +55,7 @@ func setupTestRethEngine(t *testing.T) { rethContainer, err := cli.ContainerCreate(context.Background(), &container.Config{ - Image: "ghcr.io/paradigmxyz/reth", + Image: "ghcr.io/paradigmxyz/reth:v1.1.1", Entrypoint: []string{"/bin/sh", "-c"}, Cmd: []string{ ` From c2ab7be72fc2574802cd5d70a44b391b5ebb6140 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Mon, 18 Nov 2024 18:07:00 -0600 Subject: [PATCH 34/43] merge jay/execution-api --- execution.go | 129 ++++++++++++++---------------------- execution_test.go | 158 -------------------------------------------- integration_test.go | 4 +- types.go | 60 ----------------- 4 files changed, 53 insertions(+), 298 deletions(-) delete mode 100644 types.go diff --git a/execution.go b/execution.go index ad9eeac..90f8cf9 100644 --- a/execution.go +++ b/execution.go @@ -8,18 +8,15 @@ import ( "fmt" "math/big" "net/http" - "strings" "time" - "encoding/hex" - + "github.com/ethereum/go-ethereum/beacon/engine" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/beacon/engine" "github.com/golang-jwt/jwt/v5" execution "github.com/rollkit/go-execution" @@ -121,19 +118,19 @@ func (c *EngineAPIExecutionClient) Stop() { // InitChain initializes the blockchain with genesis information func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime time.Time, initialHeight uint64, chainID string) (execution_types.Hash, uint64, error) { - var forkchoiceResult ForkchoiceUpdatedResponse + var forkchoiceResult engine.ForkChoiceResponse err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", - ForkchoiceState{ + engine.ForkchoiceStateV1{ HeadBlockHash: c.genesisHash, SafeBlockHash: c.genesisHash, FinalizedBlockHash: c.genesisHash, }, - map[string]interface{}{ - "timestamp": fmt.Sprintf("0x%X", genesisTime.Unix()), - "prevRandao": common.Hash{}, - "suggestedFeeRecipient": c.feeRecipient, - "parentBeaconBlockRoot": common.Hash{}, - "withdrawals": []struct{}{}, + engine.PayloadAttributes{ + Timestamp: uint64(genesisTime.Unix()), + Random: common.Hash{}, + SuggestedFeeRecipient: c.feeRecipient, + BeaconRoot: nil, + Withdrawals: []*types.Withdrawal{}, }, ) if err != nil { @@ -144,22 +141,18 @@ func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime ti return execution_types.Hash{}, 0, ErrNilPayloadStatus } - var payloadResult PayloadResponse + var payloadResult engine.ExecutionPayloadEnvelope err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", *forkchoiceResult.PayloadID) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV3 failed: %w", err) } - executionPayload := payloadResult["executionPayload"].(map[string]interface{}) - stateRoot := common.HexToHash(payloadResult.ExecutionPayload.StateRoot) + stateRoot := common.HexToHash(payloadResult.ExecutionPayload.StateRoot.Hex()) rollkitStateRoot := execution_types.Hash(stateRoot[:]) - gasLimitHex := executionPayload["gasLimit"].(string) - - gasLimit := new(big.Int) - gasLimit.SetString(strings.TrimPrefix(payloadResult.ExecutionPayload.GasLimit, "0x"), 16) + gasLimit := payloadResult.ExecutionPayload.GasLimit - return rollkitStateRoot, gasLimit.Uint64(), nil + return rollkitStateRoot, gasLimit, nil } // GetTxs retrieves transactions from the transaction pool @@ -210,7 +203,7 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi } } - txsPayload := make([]string, len(txs)) + txsPayload := make([][]byte, len(txs)) for i, tx := range ethTxs { buf := bytes.Buffer{} err := tx.EncodeRLP(&buf) @@ -218,7 +211,7 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi return execution_types.Hash{}, 0, fmt.Errorf("error RLP encoding tx: %s", err.Error()) } - txsPayload[i] = fmt.Sprintf("0x%x", buf.Bytes()) + txsPayload[i] = buf.Bytes() } blockHeader := types.Header{ @@ -242,32 +235,26 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi Nonce: types.BlockNonce{}, } - logsBloomStr, err := blockHeader.Bloom.MarshalText() - if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("invalid logs bloom: %w", err) - } -engine. - var newPayloadResult map[string]interface{} - err = c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", - engine.PayloadV3 - map[string]interface{}{ - "stateRoot": blockHeader.Root.Hex(), - "parentHash": blockHeader.ParentHash.Hex(), - "timestamp": hexutil.EncodeUint64(blockHeader.Time), - "prevRandao": blockHeader.MixDigest.Hex(), - "feeRecipient": blockHeader.Coinbase.Hex(), - "transactions": txsPayload, - "blobGasUsed": hexutil.EncodeUint64(*blockHeader.BlobGasUsed), - "excessBlobGas": hexutil.EncodeUint64(*blockHeader.ExcessBlobGas), - "withdrawals": []struct{}{}, - "receiptsRoot": blockHeader.ReceiptHash.Hex(), - "logsBloom": string(logsBloomStr), - "blockNumber": hexutil.EncodeBig(blockHeader.Number), - "gasLimit": hexutil.EncodeUint64(blockHeader.GasLimit), - "gasUsed": hexutil.EncodeUint64(blockHeader.GasUsed), - "extraData": "0x", - "baseFeePerGas": hexutil.EncodeBig(blockHeader.BaseFee), - "blockHash": blockHeader.Hash().Hex(), // Keccak256(RLP(ExecutionBlockHeader)) + var newPayloadResult engine.PayloadStatusV1 + err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", + engine.ExecutableData{ + StateRoot: blockHeader.Root, + ParentHash: blockHeader.ParentHash, + Timestamp: blockHeader.Time, + Random: blockHeader.MixDigest, + FeeRecipient: blockHeader.Coinbase, + Transactions: txsPayload, + BlobGasUsed: blockHeader.BlobGasUsed, + ExcessBlobGas: blockHeader.ExcessBlobGas, + Withdrawals: []*types.Withdrawal{}, + ReceiptsRoot: blockHeader.ReceiptHash, + LogsBloom: blockHeader.Bloom[:], + Number: blockHeader.Number.Uint64(), + GasLimit: blockHeader.GasLimit, + GasUsed: blockHeader.GasUsed, + ExtraData: []byte("0x"), + BaseFeePerGas: blockHeader.BaseFee, + BlockHash: blockHeader.Hash(), // Keccak256(RLP(ExecutionBlockHeader)) }, // Expected blob versioned hashes []string{ @@ -275,40 +262,27 @@ engine. }, // Root of the parent beacon block c.genesisHash.Hex(), - type newPayloadResult struct { - Status PayloadStatus `json:"status"` - } - err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", - NewPayloadRequest{ - ParentHash: common.BytesToHash(prevStateRoot[:]), - Timestamp: timestamp.Unix(), - PrevRandao: c.derivePrevRandao(height), - FeeRecipient: c.feeRecipient, - Transactions: ethTxs, - ExpectedBlobVersionedHashes: []string{}, - ParentBeaconBlockRoot: common.Hash{}, - }, ) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %s", err.Error()) } - if newPayloadResult.Status != PayloadStatusValid { + if newPayloadResult.Status != engine.VALID { return execution_types.Hash{}, 0, ErrInvalidPayloadStatus } - var forkchoiceResult ForkchoiceUpdatedResponse + var forkchoiceResult engine.ForkChoiceResponse err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", - ForkchoiceState{ + engine.ForkchoiceStateV1{ HeadBlockHash: common.BytesToHash(prevStateRoot[:]), SafeBlockHash: common.BytesToHash(prevStateRoot[:]), FinalizedBlockHash: common.BytesToHash(prevStateRoot[:]), }, - PayloadAttributes{ - Timestamp: timestamp.Unix(), - PrevRandao: c.derivePrevRandao(height), + engine.PayloadAttributes{ + Timestamp: uint64(timestamp.Unix()), + Random: c.derivePrevRandao(height), SuggestedFeeRecipient: c.feeRecipient, - ParentBeaconBlockRoot: common.Hash{}, + BeaconRoot: nil, }, ) if err != nil { @@ -319,19 +293,18 @@ engine. return execution_types.Hash{}, 0, ErrNilPayloadStatus } - var payloadResult PayloadResponse + var payloadResult engine.ExecutionPayloadEnvelope err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", *forkchoiceResult.PayloadID) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV3 failed: %w", err) } - newStateRoot := common.HexToHash(payloadResult.ExecutionPayload.StateRoot) - gasUsed := new(big.Int) - gasUsed.SetString(strings.TrimPrefix(payloadResult.ExecutionPayload.GasUsed, "0x"), 16) + newStateRoot := common.HexToHash(payloadResult.ExecutionPayload.StateRoot.Hex()) + gasUsed := payloadResult.ExecutionPayload.GasUsed var rollkitNewStateRoot execution_types.Hash copy(rollkitNewStateRoot[:], newStateRoot[:]) - return rollkitNewStateRoot, gasUsed.Uint64(), nil + return rollkitNewStateRoot, gasUsed, nil } // SetFinal marks a block at the given height as final @@ -341,22 +314,22 @@ func (c *EngineAPIExecutionClient) SetFinal(ctx context.Context, height uint64) return fmt.Errorf("failed to get block at height %d: %w", height, err) } - var forkchoiceResult ForkchoiceUpdatedResponse + var forkchoiceResult engine.ForkChoiceResponse err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", - ForkchoiceState{ + engine.ForkchoiceStateV1{ HeadBlockHash: block.Hash(), SafeBlockHash: block.Hash(), FinalizedBlockHash: block.Hash(), }, - PayloadAttributes{ - ParentBeaconBlockRoot: common.Hash{}, + engine.PayloadAttributes{ + BeaconRoot: nil, }, ) if err != nil { return fmt.Errorf("engine_forkchoiceUpdatedV3 failed for finalization: %w", err) } - if forkchoiceResult.PayloadStatus.Status != PayloadStatusValid { + if forkchoiceResult.PayloadStatus.Status != engine.VALID { return ErrInvalidPayloadStatus } diff --git a/execution_test.go b/execution_test.go index da5d50e..861640f 100644 --- a/execution_test.go +++ b/execution_test.go @@ -3,7 +3,6 @@ package execution import ( "context" "encoding/json" - "fmt" "io" "net/http" "net/http/httptest" @@ -18,163 +17,6 @@ import ( execution_types "github.com/rollkit/go-execution/types" "github.com/stretchr/testify/require" ) -type mockEngineAPI struct { - *httptest.Server -} - -func newMockEngineAPI(t *testing.T) *mockEngineAPI { - t.Helper() - - mock := &mockEngineAPI{} - mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - var resp map[string]interface{} - - body, err := io.ReadAll(r.Body) - require.NoError(t, err) - - var req map[string]interface{} - err = json.Unmarshal(body, &req) - require.NoError(t, err) - - method := req["method"].(string) - switch method { - case "engine_newPayloadV1": - resp = map[string]interface{}{ - "status": "VALID", - "latestValidHash": "0x1234", - } - case "engine_forkchoiceUpdatedV1": - resp = map[string]interface{}{ - "payloadStatus": map[string]interface{}{ - "status": "VALID", - }, - "payloadId": "0x1234", - } - case "engine_getPayloadV1": - resp = map[string]interface{}{ - "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", - "gasUsed": "0x5208", - "gasLimit": "0xf4240", - } - } - - json.NewEncoder(w).Encode(map[string]interface{}{ - "jsonrpc": "2.0", - "id": req["id"], - "result": resp, - }) - })) - - return mock -} - -type mockEthAPI struct { - *httptest.Server -} - -func newMockEthAPI(t *testing.T) *mockEthAPI { - t.Helper() - - mock := &mockEthAPI{} - mock.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - var resp interface{} - - body, err := io.ReadAll(r.Body) - require.NoError(t, err) - - var req map[string]interface{} - err = json.Unmarshal(body, &req) - require.NoError(t, err) - - method := req["method"].(string) - switch method { - case "txpool_content": - resp = map[string]interface{}{ - "pending": map[string]interface{}{ - "0x1234567890123456789012345678901234567890": map[string]interface{}{ - "0": map[string]interface{}{ - "input": "0x123456", - "nonce": "0x0", - "from": "0x1234567890123456789012345678901234567890", - "to": "0x0987654321098765432109876543210987654321", - "value": "0x0", - "gas": "0x5208", - "gasPrice": "0x3b9aca00", - "chainId": "0x1", - "v": "0x1b", - "r": "0x1234", - "s": "0x5678", - "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", - "type": "0x0", - }, - }, - }, - "queued": map[string]interface{}{}, - } - case "eth_getBlockByNumber", "eth_blockByNumber": - params := req["params"].([]interface{}) - blockNumRaw := params[0] - fullTx := false - if len(params) > 1 { - fullTx = params[1].(bool) - } - - var blockNum string - switch v := blockNumRaw.(type) { - case string: - blockNum = v - case float64: - blockNum = fmt.Sprintf("0x%x", int64(v)) - } - - if blockNum == "0x1" { - emptyBlockHash := "0x0000000000000000000000000000000000000000000000000000000000000000" - blockResp := map[string]interface{}{ - "hash": "0x1234567890123456789012345678901234567890123456789012345678901234", - "number": "0x1", - "parentHash": emptyBlockHash, - "timestamp": "0x0", - "stateRoot": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", - "receiptsRoot": emptyBlockHash, - "transactionsRoot": emptyBlockHash, - "sha3Uncles": emptyBlockHash, - "logsBloom": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "difficulty": "0x0", - "totalDifficulty": "0x0", - "size": "0x0", - "gasLimit": "0x1000000", - "gasUsed": "0x0", - "miner": "0x0000000000000000000000000000000000000000", - "extraData": "0x", - "mixHash": emptyBlockHash, - "nonce": "0x0000000000000000", - "baseFeePerGas": "0x0", - "uncles": []interface{}{}, - } - - if fullTx { - blockResp["transactions"] = []interface{}{} - } else { - blockResp["transactions"] = []interface{}{} - } - - resp = blockResp - } - t.Logf("Requested block number: %s, Matching: %v", blockNum, blockNum == "0x1") - } - - t.Logf("Request: %s, Params: %v", method, req["params"]) - t.Logf("Response: %v", resp) - - json.NewEncoder(w).Encode(map[string]interface{}{ - "jsonrpc": "2.0", - "id": req["id"], - "result": resp, - }) - })) - - return mock -} // Helper function to generate a test JWT secret func generateTestJWTSecret() string { diff --git a/integration_test.go b/integration_test.go index f6722bb..c6c1a61 100644 --- a/integration_test.go +++ b/integration_test.go @@ -212,7 +212,7 @@ func TestExecutionClient_InitChain_InvalidPayloadTimestamp(t *testing.T) { initialHeight := uint64(0) genesisHash := common.HexToHash(GENESIS_HASH) - genesisTime := time.Date(2024, 3, 13, 13, 54, 0, 0, time.UTC) // pre-cancun timestamp not supported + blockTime := time.Date(2024, 3, 13, 13, 54, 0, 0, time.UTC) // pre-cancun timestamp not supported executionClient, err := NewEngineAPIExecutionClient( &proxy_json_rpc.Config{}, @@ -224,7 +224,7 @@ func TestExecutionClient_InitChain_InvalidPayloadTimestamp(t *testing.T) { ) require.NoError(t, err) - _, _, err = executionClient.InitChain(context.Background(), genesisTime, initialHeight, CHAIN_ID) + _, _, err = executionClient.InitChain(context.Background(), blockTime, initialHeight, CHAIN_ID) // payload timestamp is not within the cancun timestamp require.Error(t, err) require.ErrorContains(t, err, "Unsupported fork") diff --git a/types.go b/types.go deleted file mode 100644 index d50dce8..0000000 --- a/types.go +++ /dev/null @@ -1,60 +0,0 @@ -package execution - -import ( - "github.com/ethereum/go-ethereum/common" -) - -type PayloadStatus string - -const ( - PayloadStatusValid PayloadStatus = "VALID" - PayloadStatusInvalid PayloadStatus = "INVALID" - PayloadStatusSyncing PayloadStatus = "SYNCING" -) - -// ForkchoiceUpdatedResponse represents the response from engine_forkchoiceUpdatedV3 -type ForkchoiceUpdatedResponse struct { - PayloadStatus struct { - Status PayloadStatus `json:"status"` - ValidationError *string `json:"validationError,omitempty"` - } `json:"payloadStatus"` - PayloadID *string `json:"payloadId,omitempty"` -} - -// ExecutionPayload represents the payload data from the execution client -type ExecutionPayload struct { - StateRoot string `json:"stateRoot"` - GasUsed string `json:"gasUsed"` - GasLimit string `json:"gasLimit"` -} - -// PayloadResponse represents the response from engine_getPayloadV3 -type PayloadResponse struct { - ExecutionPayload ExecutionPayload `json:"executionPayload"` -} - -// ForkchoiceState represents the forkchoice state for engine API calls -type ForkchoiceState struct { - HeadBlockHash common.Hash `json:"headBlockHash"` - SafeBlockHash common.Hash `json:"safeBlockHash"` - FinalizedBlockHash common.Hash `json:"finalizedBlockHash"` -} - -// PayloadAttributes represents the payload attributes for engine API calls -type PayloadAttributes struct { - Timestamp int64 `json:"timestamp"` - PrevRandao common.Hash `json:"prevRandao"` - SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient"` - ParentBeaconBlockRoot common.Hash `json:"parentBeaconBlockRoot"` -} - -// NewPayloadRequest represents the request parameters for engine_newPayloadV3 -type NewPayloadRequest struct { - ParentHash common.Hash `json:"parentHash"` - Timestamp int64 `json:"timestamp"` - PrevRandao common.Hash `json:"prevRandao"` - FeeRecipient common.Address `json:"feeRecipient"` - Transactions [][]byte `json:"transactions"` - ExpectedBlobVersionedHashes []string `json:"expectedBlobVersionedHashes"` - ParentBeaconBlockRoot common.Hash `json:"parentBeaconBlockRoot"` -} From 9dbd19718b2260344a53b8b6d5e89bc34e9900d4 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Mon, 18 Nov 2024 18:42:42 -0600 Subject: [PATCH 35/43] fix initChain unit tests --- execution_test.go | 3 +-- mocks/mocks.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/execution_test.go b/execution_test.go index 861640f..3466d42 100644 --- a/execution_test.go +++ b/execution_test.go @@ -55,8 +55,7 @@ func TestEngineAPIExecutionClient_InitChain(t *testing.T) { require.NoError(t, err) mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef") - var expectedStateRoot execution_types.Hash - copy(expectedStateRoot[:], mockStateRoot.Bytes()) + expectedStateRoot := execution_types.Hash(mockStateRoot[:]) require.Equal(t, expectedStateRoot, stateRoot) require.Equal(t, uint64(1000000), gasLimit) diff --git a/mocks/mocks.go b/mocks/mocks.go index 4f83b9b..774c3b9 100644 --- a/mocks/mocks.go +++ b/mocks/mocks.go @@ -62,7 +62,7 @@ func NewMockEngineAPI(t *testing.T) *MockEngineAPI { "latestValidHash": nil, "validationError": nil, }, - "payloadId": "0x1234", + "payloadId": "0x123456789abcdef0", } case "engine_getPayloadV3": resp = map[string]interface{}{ From 2aef2ca096a09eaf8dca1125a58bc6d120b6657f Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Mon, 18 Nov 2024 19:06:56 -0600 Subject: [PATCH 36/43] fix executeTxs api unit tests --- execution_test.go | 9 ++++++--- mocks/mocks.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/execution_test.go b/execution_test.go index 3466d42..c66d367 100644 --- a/execution_test.go +++ b/execution_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "io" + "math/big" "net/http" "net/http/httptest" "testing" @@ -12,6 +13,7 @@ import ( "encoding/hex" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" "github.com/rollkit/go-execution-evm/mocks" proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc" execution_types "github.com/rollkit/go-execution/types" @@ -88,10 +90,11 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) { blockHeight := uint64(1) timestamp := time.Now().UTC().Truncate(time.Second) - var prevStateRoot execution_types.Hash - copy(prevStateRoot[:], []byte{1, 2, 3}) + prevStateRoot := execution_types.Hash(common.Hex2Bytes("111122223333444455556666777788889999aaaabbbbccccddddeeeeffff0000")) - testTx := execution_types.Tx("test transaction") + testTxBytes, err := types.NewTransaction(1, common.Address{}, big.NewInt(0), 1000, big.NewInt(875000000), nil).MarshalBinary() + require.NoError(t, err) + testTx := execution_types.Tx(testTxBytes) ctx := context.Background() stateRoot, gasUsed, err := client.ExecuteTxs( diff --git a/mocks/mocks.go b/mocks/mocks.go index 774c3b9..f0a4aba 100644 --- a/mocks/mocks.go +++ b/mocks/mocks.go @@ -43,7 +43,7 @@ func NewMockEngineAPI(t *testing.T) *MockEngineAPI { case "engine_newPayloadV3": resp = map[string]interface{}{ "status": "VALID", - "latestValidHash": "0x1234", + "latestValidHash": "0x222211113333444455556666777788889999aaaabbbbccccddddeeeeffff0000", "validationError": nil, } case "engine_forkchoiceUpdatedV3": From 2f5442ed64a4fa87ee0a8acb8186ae3975c26601 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Mon, 18 Nov 2024 19:30:12 -0600 Subject: [PATCH 37/43] fix initChain api integration tests --- execution.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/execution.go b/execution.go index 90f8cf9..29eccb3 100644 --- a/execution.go +++ b/execution.go @@ -129,7 +129,7 @@ func (c *EngineAPIExecutionClient) InitChain(ctx context.Context, genesisTime ti Timestamp: uint64(genesisTime.Unix()), Random: common.Hash{}, SuggestedFeeRecipient: c.feeRecipient, - BeaconRoot: nil, + BeaconRoot: &c.genesisHash, Withdrawals: []*types.Withdrawal{}, }, ) From f0431ccd4251ab2b5720d4377169a19c31b2a8ec Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Mon, 18 Nov 2024 22:01:13 -0600 Subject: [PATCH 38/43] fix reth setup for integration tests --- integration_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integration_test.go b/integration_test.go index c6c1a61..71865d0 100644 --- a/integration_test.go +++ b/integration_test.go @@ -120,7 +120,7 @@ func setupTestRethEngine(t *testing.T) { } func TestExecutionClientLifecycle(t *testing.T) { - // setupTestRethEngine(t) + setupTestRethEngine(t) initialHeight := uint64(0) genesisHash := common.HexToHash(GENESIS_HASH) @@ -128,7 +128,7 @@ func TestExecutionClientLifecycle(t *testing.T) { genesisStateroot := common.HexToHash(GENESIS_STATEROOT) rollkitGenesisStateRoot := rollkit_types.Hash(genesisStateroot[:]) - _, err := ethclient.Dial(TEST_ETH_URL) + rpcClient, err := ethclient.Dial(TEST_ETH_URL) require.NoError(t, err) executionClient, err := NewEngineAPIExecutionClient( @@ -167,8 +167,8 @@ func TestExecutionClientLifecycle(t *testing.T) { rSignedTx, sSignedTx, vSignedTx := signedTx.RawSignatureValues() - // err = rpcClient.SendTransaction(context.Background(), signedTx) - // require.NoError(t, err) + err = rpcClient.SendTransaction(context.Background(), signedTx) + require.NoError(t, err) t.Run("GetTxs", func(t *testing.T) { txs, err := executionClient.GetTxs(context.Background()) From a66d9c7b68a796f60be72e68b5b96eda1e6fef29 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Mon, 18 Nov 2024 22:39:28 -0600 Subject: [PATCH 39/43] fix genproto module dependency --- go.mod | 30 ++++++++++++-------- go.sum | 88 +++++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 81 insertions(+), 37 deletions(-) diff --git a/go.mod b/go.mod index a7f2a48..69cf8fa 100644 --- a/go.mod +++ b/go.mod @@ -27,6 +27,7 @@ require ( github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/containerd/log v0.1.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect @@ -34,8 +35,6 @@ require ( github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/distribution/reference v0.6.0 // indirect - github.com/docker/docker v27.3.1+incompatible // indirect - github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect @@ -48,7 +47,6 @@ require ( github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect - github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/holiman/uint256 v1.3.1 // indirect @@ -68,6 +66,8 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect + github.com/moby/term v0.5.0 // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect @@ -97,24 +97,30 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect - go.opentelemetry.io/otel v1.31.0 // indirect - go.opentelemetry.io/otel/metric v1.31.0 // indirect - go.opentelemetry.io/otel/trace v1.31.0 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.26.0 // indirect + golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/text v0.17.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - google.golang.org/protobuf v1.34.2 // indirect + golang.org/x/sync v0.9.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/text v0.20.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.5.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) require ( + github.com/docker/docker v27.3.1+incompatible + github.com/docker/go-connections v0.5.0 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/stretchr/testify v1.9.0 ) diff --git a/go.sum b/go.sum index c977bd1..1004220 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= 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= @@ -19,9 +21,12 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9 github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/celestiaorg/go-header v0.6.3 h1:VI+fsNxFLeUS7cNn0LgHP6Db66uslnKp/fgMg5nxqHg= github.com/celestiaorg/go-header v0.6.3/go.mod h1:Az4S4NxMOJ1eAzOaF8u5AZt5UzsSzg92uqpdXS3yOZE= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= @@ -40,6 +45,8 @@ github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJ github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= @@ -91,6 +98,8 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqG github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -107,10 +116,10 @@ github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -119,8 +128,6 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -137,6 +144,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 h1:ad0vkEBuk23VJzZR9nkLVG0YAoN9coASF1GusYX6AlU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0/go.mod h1:igFoXX2ELCW06bol23DWPB5BEWfZISOzSP5K2sbLea0= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= @@ -230,6 +239,10 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= @@ -256,14 +269,18 @@ github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dy github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= +github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -273,6 +290,8 @@ github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pion/datachannel v1.5.6 h1:1IxKJntfSlYkpUj8LlYRSWpYiTTC02nUrOE8T3DqGeg= github.com/pion/datachannel v1.5.6/go.mod h1:1eKT6Q85pRnr2mHiWHxJwO50SfZRtWHTsNIVb/NfGW4= github.com/pion/dtls/v2 v2.2.11 h1:9U/dpCYl1ySttROPWJgqWKEylUdT0fXp/xst6JwY5Ks= @@ -335,10 +354,13 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= @@ -369,12 +391,20 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= -go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0 h1:IJFEoHiytixx8cMiVAO+GmHR6Frwu+u5Ur8njpFO6Ac= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0/go.mod h1:3rHrKNtLIoS0oZwkY2vxi+oJcwFRWdtUyRII+so45p8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 h1:cMyu9O88joYEaI47CnQkxO1XZdpoTF9fEnW2duIddhw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0/go.mod h1:6Am3rn7P9TVVeXYG+wtcGE7IE1tsQ+bP3AuWcKt/gOI= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= @@ -395,8 +425,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -414,17 +444,15 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -445,14 +473,14 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -466,15 +494,22 @@ golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxb golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f h1:M65LEviCfuZTfrfzwwEoxVtgvfkFkBUbFnRbxCXuXhU= +google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f/go.mod h1:Yo94eF2nj7igQt+TiJ49KxjIH8ndLYPZMIRSiRcEbg0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f h1:C1QccEa9kUwvMgEUORqQD9S17QesQijxjZ84sO82mfo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= @@ -482,6 +517,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -492,6 +528,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= From 73cc0eb14f4579de3fae33159ffb9b651de0d7f3 Mon Sep 17 00:00:00 2001 From: Janani Anbarasan Date: Mon, 18 Nov 2024 22:46:13 -0600 Subject: [PATCH 40/43] downgrade go-ethereum --- go.mod | 42 +++++--------------- go.sum | 118 ++++++++++++--------------------------------------------- 2 files changed, 35 insertions(+), 125 deletions(-) diff --git a/go.mod b/go.mod index 69cf8fa..ce52057 100644 --- a/go.mod +++ b/go.mod @@ -5,42 +5,29 @@ go 1.22.8 replace github.com/rollkit/go-execution => github.com/lastdotnet/go-execution v0.0.0-20241108025553-291f75953069 require ( - github.com/ethereum/go-ethereum v1.14.11 + github.com/ethereum/go-ethereum v1.14.6-0.20241115130523-7c0ff0568509 github.com/rollkit/go-execution v0.0.0-00010101000000-000000000000 ) require ( - github.com/DataDog/zstd v1.4.5 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/StackExchange/wmi v1.2.1 // indirect - github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.13.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect - github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect + github.com/bits-and-blooms/bitset v1.15.0 // indirect github.com/celestiaorg/go-header v0.6.3 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cockroachdb/errors v1.11.3 // indirect - github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect - github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.2 // indirect - github.com/cockroachdb/redact v1.1.5 // indirect - github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/consensys/bavard v0.1.22 // indirect + github.com/consensys/gnark-crypto v0.14.0 // indirect github.com/containerd/log v0.1.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect - github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect - github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect + github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect + github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/ethereum/c-kzg-4844 v1.0.0 // indirect - github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect + github.com/ethereum/c-kzg-4844 v1.0.3 // indirect + github.com/ethereum/go-verkle v0.2.2 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/getsentry/sentry-go v0.27.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -52,10 +39,7 @@ require ( github.com/holiman/uint256 v1.3.1 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect - github.com/klauspost/compress v1.17.8 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/kr/text v0.2.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-libp2p v0.35.0 // indirect github.com/libp2p/go-libp2p-pubsub v0.11.0 // indirect @@ -83,17 +67,11 @@ require ( github.com/opencontainers/image-spec v1.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.48.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.11.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/supranational/blst v0.3.13 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect @@ -104,11 +82,11 @@ require ( go.opentelemetry.io/otel/trace v1.32.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.28.0 // indirect + golang.org/x/crypto v0.29.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/sync v0.9.0 // indirect golang.org/x/sys v0.27.0 // indirect - golang.org/x/text v0.20.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect google.golang.org/protobuf v1.35.2 // indirect diff --git a/go.sum b/go.sum index 1004220..e547568 100644 --- a/go.sum +++ b/go.sum @@ -13,20 +13,15 @@ github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= -github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= -github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/bits-and-blooms/bitset v1.15.0 h1:DiCRMscZsGyYePE9AR3sVhKqUXCt5IZvkX5AfAc5xLQ= +github.com/bits-and-blooms/bitset v1.15.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/celestiaorg/go-header v0.6.3 h1:VI+fsNxFLeUS7cNn0LgHP6Db66uslnKp/fgMg5nxqHg= github.com/celestiaorg/go-header v0.6.3/go.mod h1:Az4S4NxMOJ1eAzOaF8u5AZt5UzsSzg92uqpdXS3yOZE= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= -github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= @@ -39,10 +34,10 @@ github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwP github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= -github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= -github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= -github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/consensys/bavard v0.1.22 h1:Uw2CGvbXSZWhqK59X0VG/zOjpTFuOMcPLStrp1ihI0A= +github.com/consensys/bavard v0.1.22/go.mod h1:k/zVjHHC4B+PQy1Pg7fgvG3ALicQw540Crag8qx+dZs= +github.com/consensys/gnark-crypto v0.14.0 h1:DDBdl4HaBtdQsq/wfMwJvZNE80sHidrK3Nfrefatm0E= +github.com/consensys/gnark-crypto v0.14.0/go.mod h1:CU4UijNPsHawiVGNxe9co07FkzCeWHHrb1li/n1XoU0= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= @@ -51,11 +46,10 @@ github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8 github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= -github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= -github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= -github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg= +github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM= +github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4= +github.com/crate-crypto/go-kzg-4844 v1.1.0/go.mod h1:JolLjpSff1tCCJKaJx4psrlEdlXuJEC996PL3tTAFks= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -78,28 +72,20 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4 github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= -github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.14.11 h1:8nFDCUUE67rPc6AKxFj7JKaOa2W/W1Rse3oS6LvvxEY= -github.com/ethereum/go-ethereum v1.14.11/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= -github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A= -github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= +github.com/ethereum/c-kzg-4844 v1.0.3 h1:IEnbOHwjixW2cTvKRUlAAUOeleV7nNM/umJR+qy4WDs= +github.com/ethereum/c-kzg-4844 v1.0.3/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/go-ethereum v1.14.6-0.20241115130523-7c0ff0568509 h1:NOseif/YSXySPVUOfPDGgwyL4hheJaK2VJLa4fMc1AQ= +github.com/ethereum/go-ethereum v1.14.6-0.20241115130523-7c0ff0568509/go.mod h1:3hFfXPoLxRMg3VKcGQCDF+wxU3Oo+LrmkFbcTZe53cI= +github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8= +github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -116,23 +102,12 @@ github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= +github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= @@ -156,7 +131,6 @@ github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZ github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= @@ -186,8 +160,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lastdotnet/go-execution v0.0.0-20241108025553-291f75953069 h1:GnaHqG+ixzkaBtWzvaZCpNgNZnsf/liacgK39t55nHE= github.com/lastdotnet/go-execution v0.0.0-20241108025553-291f75953069/go.mod h1:JYUo1RXqdVQjuOFhU8oO6g7pKOk29ZFsdizMXkHwVdA= -github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzWu4= +github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= @@ -268,20 +242,10 @@ github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= -github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= @@ -290,8 +254,6 @@ github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pion/datachannel v1.5.6 h1:1IxKJntfSlYkpUj8LlYRSWpYiTTC02nUrOE8T3DqGeg= github.com/pion/datachannel v1.5.6/go.mod h1:1eKT6Q85pRnr2mHiWHxJwO50SfZRtWHTsNIVb/NfGW4= github.com/pion/dtls/v2 v2.2.11 h1:9U/dpCYl1ySttROPWJgqWKEylUdT0fXp/xst6JwY5Ks= @@ -324,7 +286,6 @@ github.com/pion/turn/v2 v2.1.6 h1:Xr2niVsiPTB0FPtt+yAWKFUkU1eotQbGgpTIld4x1Gc= github.com/pion/turn/v2 v2.1.6/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY= github.com/pion/webrtc/v3 v3.2.40 h1:Wtfi6AZMQg+624cvCXUuSmrKWepSB7zfgYDOYqsSOVU= github.com/pion/webrtc/v3 v3.2.40/go.mod h1:M1RAe3TNTD1tzyvqHrbVODfwdPGSXOUo/OgpoGGJqFY= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -349,9 +310,8 @@ github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtB github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= @@ -363,8 +323,6 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= -github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= @@ -380,8 +338,6 @@ github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFA github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= -github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= -github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= @@ -425,8 +381,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -435,34 +391,23 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -477,7 +422,6 @@ golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= @@ -494,7 +438,6 @@ golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxb golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f h1:M65LEviCfuZTfrfzwwEoxVtgvfkFkBUbFnRbxCXuXhU= google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f/go.mod h1:Yo94eF2nj7igQt+TiJ49KxjIH8ndLYPZMIRSiRcEbg0= @@ -502,26 +445,15 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 4f6afe612d75e9f2c3236fa7f8ab70a00c8d4137 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 19 Nov 2024 17:24:29 -0800 Subject: [PATCH 41/43] fix: block hash mismatch when executing txs --- execution.go | 120 +++++++++++++++++++-------------------------------- 1 file changed, 45 insertions(+), 75 deletions(-) diff --git a/execution.go b/execution.go index 29eccb3..e07504f 100644 --- a/execution.go +++ b/execution.go @@ -8,15 +8,14 @@ import ( "fmt" "math/big" "net/http" + "strings" "time" "github.com/ethereum/go-ethereum/beacon/engine" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/trie" "github.com/golang-jwt/jwt/v5" execution "github.com/rollkit/go-execution" @@ -194,117 +193,88 @@ func (c *EngineAPIExecutionClient) GetTxs(ctx context.Context) ([]execution_type // ExecuteTxs executes the given transactions and returns the new state root and gas used func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []execution_types.Tx, height uint64, timestamp time.Time, prevStateRoot execution_types.Hash) (execution_types.Hash, uint64, error) { + // Convert rollkit transactions to Ethereum transactions ethTxs := make([]*types.Transaction, len(txs)) for i, tx := range txs { ethTxs[i] = new(types.Transaction) err := ethTxs[i].UnmarshalBinary(tx) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %s", err.Error()) + return execution_types.Hash{}, 0, fmt.Errorf("failed to unmarshal transaction: %w", err) } } + // Encode transactions for payload txsPayload := make([][]byte, len(txs)) for i, tx := range ethTxs { buf := bytes.Buffer{} err := tx.EncodeRLP(&buf) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("error RLP encoding tx: %s", err.Error()) + return execution_types.Hash{}, 0, fmt.Errorf("failed to RLP encode tx: %w", err) } - txsPayload[i] = buf.Bytes() } - blockHeader := types.Header{ - Root: common.Hash(prevStateRoot), - ParentHash: common.BytesToHash(prevStateRoot[:]), - UncleHash: types.EmptyUncleHash, - Time: uint64(1731729558), // timestamp.Unix - Coinbase: c.feeRecipient, - MixDigest: c.derivePrevRandao(height), - BlobGasUsed: new(uint64), - ExcessBlobGas: new(uint64), - ReceiptHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), - Bloom: types.Bloom{}, - Number: big.NewInt(int64(height)), - GasLimit: 30000000, - GasUsed: 20000000, - Extra: hexutil.Bytes("0x"), - BaseFee: big.NewInt(7), - TxHash: types.DeriveSha(types.Transactions(ethTxs), trie.NewStackTrie(nil)), - Difficulty: big.NewInt(0), - Nonce: types.BlockNonce{}, - } - - var newPayloadResult engine.PayloadStatusV1 - err := c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", - engine.ExecutableData{ - StateRoot: blockHeader.Root, - ParentHash: blockHeader.ParentHash, - Timestamp: blockHeader.Time, - Random: blockHeader.MixDigest, - FeeRecipient: blockHeader.Coinbase, - Transactions: txsPayload, - BlobGasUsed: blockHeader.BlobGasUsed, - ExcessBlobGas: blockHeader.ExcessBlobGas, - Withdrawals: []*types.Withdrawal{}, - ReceiptsRoot: blockHeader.ReceiptHash, - LogsBloom: blockHeader.Bloom[:], - Number: blockHeader.Number.Uint64(), - GasLimit: blockHeader.GasLimit, - GasUsed: blockHeader.GasUsed, - ExtraData: []byte("0x"), - BaseFeePerGas: blockHeader.BaseFee, - BlockHash: blockHeader.Hash(), // Keccak256(RLP(ExecutionBlockHeader)) - }, - // Expected blob versioned hashes - []string{ - "0x0000000000000000000000000000000000000000000000000000000000000000", - }, - // Root of the parent beacon block - c.genesisHash.Hex(), - ) - if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_newPayloadV3 failed: %s", err.Error()) - } - - if newPayloadResult.Status != engine.VALID { - return execution_types.Hash{}, 0, ErrInvalidPayloadStatus - } - + // Update forkchoice with payload attributes var forkchoiceResult engine.ForkChoiceResponse - err = c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", + err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", engine.ForkchoiceStateV1{ - HeadBlockHash: common.BytesToHash(prevStateRoot[:]), - SafeBlockHash: common.BytesToHash(prevStateRoot[:]), - FinalizedBlockHash: common.BytesToHash(prevStateRoot[:]), + HeadBlockHash: c.genesisHash, + SafeBlockHash: c.genesisHash, + FinalizedBlockHash: c.genesisHash, }, - engine.PayloadAttributes{ + &engine.PayloadAttributes{ Timestamp: uint64(timestamp.Unix()), Random: c.derivePrevRandao(height), SuggestedFeeRecipient: c.feeRecipient, - BeaconRoot: nil, + Withdrawals: []*types.Withdrawal{}, + BeaconRoot: &c.genesisHash, }, ) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_forkchoiceUpdatedV3 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("forkchoice update failed: %w", err) } if forkchoiceResult.PayloadID == nil { return execution_types.Hash{}, 0, ErrNilPayloadStatus } + // Get the built payload var payloadResult engine.ExecutionPayloadEnvelope err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", *forkchoiceResult.PayloadID) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV3 failed: %w", err) + return execution_types.Hash{}, 0, fmt.Errorf("get payload failed: %w", err) } - newStateRoot := common.HexToHash(payloadResult.ExecutionPayload.StateRoot.Hex()) - gasUsed := payloadResult.ExecutionPayload.GasUsed + // Submit the new payload + var newPayloadResult engine.PayloadStatusV1 + err = c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", + payloadResult.ExecutionPayload, + []string{}, // No blob hashes + c.genesisHash.Hex(), + ) + if err != nil { + return execution_types.Hash{}, 0, fmt.Errorf("new payload submission failed: %w", err) + } + + if newPayloadResult.Status != engine.VALID { + return execution_types.Hash{}, 0, ErrInvalidPayloadStatus + } + + // convert the state root from the payload + stateRootHex := payloadResult.ExecutionPayload.StateRoot.String() + stateRootBytes, err := hex.DecodeString(strings.TrimPrefix(stateRootHex, "0x")) + if err != nil { + return execution_types.Hash{}, 0, fmt.Errorf("failed to decode state root hex: %w", err) + } + + var rollkitStateRoot execution_types.Hash + copy(rollkitStateRoot[:], stateRootBytes) + + fmt.Printf("State root hex: %s\n", stateRootHex) + fmt.Printf("State root bytes: %x\n", stateRootBytes) + fmt.Printf("Rollkit state root: %x\n", rollkitStateRoot) // DEBUG: always nil - var rollkitNewStateRoot execution_types.Hash - copy(rollkitNewStateRoot[:], newStateRoot[:]) - return rollkitNewStateRoot, gasUsed, nil + return rollkitStateRoot, payloadResult.ExecutionPayload.GasUsed, nil } // SetFinal marks a block at the given height as final From ef272c4c8c0599d09238ba4d6f84e06810c94985 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 19 Nov 2024 17:43:33 -0800 Subject: [PATCH 42/43] test: fix ExecuteTxs --- execution.go | 34 +++++++++++++++++----------------- integration_test.go | 4 +--- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/execution.go b/execution.go index e07504f..96f5594 100644 --- a/execution.go +++ b/execution.go @@ -8,7 +8,6 @@ import ( "fmt" "math/big" "net/http" - "strings" "time" "github.com/ethereum/go-ethereum/beacon/engine" @@ -193,7 +192,7 @@ func (c *EngineAPIExecutionClient) GetTxs(ctx context.Context) ([]execution_type // ExecuteTxs executes the given transactions and returns the new state root and gas used func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []execution_types.Tx, height uint64, timestamp time.Time, prevStateRoot execution_types.Hash) (execution_types.Hash, uint64, error) { - // Convert rollkit transactions to Ethereum transactions + // convert rollkit tx to eth tx ethTxs := make([]*types.Transaction, len(txs)) for i, tx := range txs { ethTxs[i] = new(types.Transaction) @@ -203,7 +202,7 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi } } - // Encode transactions for payload + // encode txsPayload := make([][]byte, len(txs)) for i, tx := range ethTxs { buf := bytes.Buffer{} @@ -214,7 +213,7 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi txsPayload[i] = buf.Bytes() } - // Update forkchoice with payload attributes + // update forkchoice var forkchoiceResult engine.ForkChoiceResponse err := c.engineClient.CallContext(ctx, &forkchoiceResult, "engine_forkchoiceUpdatedV3", engine.ForkchoiceStateV1{ @@ -238,14 +237,14 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi return execution_types.Hash{}, 0, ErrNilPayloadStatus } - // Get the built payload + // get payload var payloadResult engine.ExecutionPayloadEnvelope err = c.engineClient.CallContext(ctx, &payloadResult, "engine_getPayloadV3", *forkchoiceResult.PayloadID) if err != nil { return execution_types.Hash{}, 0, fmt.Errorf("get payload failed: %w", err) } - // Submit the new payload + // submit payload var newPayloadResult engine.PayloadStatusV1 err = c.engineClient.CallContext(ctx, &newPayloadResult, "engine_newPayloadV3", payloadResult.ExecutionPayload, @@ -261,20 +260,21 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi } // convert the state root from the payload - stateRootHex := payloadResult.ExecutionPayload.StateRoot.String() - stateRootBytes, err := hex.DecodeString(strings.TrimPrefix(stateRootHex, "0x")) - if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("failed to decode state root hex: %w", err) - } + // stateRootHex := payloadResult.ExecutionPayload.StateRoot.String() + // stateRootBytes, err := hex.DecodeString(strings.TrimPrefix(stateRootHex, "0x")) + // if err != nil { + // return execution_types.Hash{}, 0, fmt.Errorf("failed to decode state root hex: %w", err) + // } - var rollkitStateRoot execution_types.Hash - copy(rollkitStateRoot[:], stateRootBytes) + // var rollkitStateRoot execution_types.Hash + // copy(rollkitStateRoot[:], stateRootBytes) - fmt.Printf("State root hex: %s\n", stateRootHex) - fmt.Printf("State root bytes: %x\n", stateRootBytes) - fmt.Printf("Rollkit state root: %x\n", rollkitStateRoot) // DEBUG: always nil + fmt.Printf("State root: %x\n", payloadResult.ExecutionPayload.StateRoot.Bytes()) + fmt.Printf("State root hex: %s\n", payloadResult.ExecutionPayload.StateRoot.String()) + // fmt.Printf("State root bytes: %x\n", stateRootBytes) + //fmt.Printf("Rollkit state root: %x\n", rollkitStateRoot) // DEBUG: always nil - return rollkitStateRoot, payloadResult.ExecutionPayload.GasUsed, nil + return payloadResult.ExecutionPayload.StateRoot.Bytes(), payloadResult.ExecutionPayload.GasUsed, nil } // SetFinal marks a block at the given height as final diff --git a/integration_test.go b/integration_test.go index 71865d0..43e4135 100644 --- a/integration_test.go +++ b/integration_test.go @@ -197,13 +197,11 @@ func TestExecutionClientLifecycle(t *testing.T) { t.Run("ExecuteTxs", func(t *testing.T) { newStateroot := common.HexToHash("0x362b7d8a31e7671b0f357756221ac385790c25a27ab222dc8cbdd08944f5aea4") - var rollkitNewStateRoot rollkit_types.Hash - copy(rollkitNewStateRoot[:], newStateroot.Bytes()) stateroot, gasUsed, err := executionClient.ExecuteTxs(context.Background(), []rollkit_types.Tx{rollkit_types.Tx(txBytes)}, blockHeight, blockTime, rollkitGenesisStateRoot) require.NoError(t, err) assert.Greater(t, gasLimit, gasUsed) - assert.Equal(t, newStateroot, stateroot) + assert.Equal(t, newStateroot.Bytes(), []byte(stateroot)) }) } From bd037f4edeb4becbc124ac84ee7a568674c24f48 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 19 Nov 2024 17:51:36 -0800 Subject: [PATCH 43/43] chore: remove redundant debug prints --- execution.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/execution.go b/execution.go index 96f5594..876addf 100644 --- a/execution.go +++ b/execution.go @@ -259,21 +259,6 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi return execution_types.Hash{}, 0, ErrInvalidPayloadStatus } - // convert the state root from the payload - // stateRootHex := payloadResult.ExecutionPayload.StateRoot.String() - // stateRootBytes, err := hex.DecodeString(strings.TrimPrefix(stateRootHex, "0x")) - // if err != nil { - // return execution_types.Hash{}, 0, fmt.Errorf("failed to decode state root hex: %w", err) - // } - - // var rollkitStateRoot execution_types.Hash - // copy(rollkitStateRoot[:], stateRootBytes) - - fmt.Printf("State root: %x\n", payloadResult.ExecutionPayload.StateRoot.Bytes()) - fmt.Printf("State root hex: %s\n", payloadResult.ExecutionPayload.StateRoot.String()) - // fmt.Printf("State root bytes: %x\n", stateRootBytes) - //fmt.Printf("Rollkit state root: %x\n", rollkitStateRoot) // DEBUG: always nil - return payloadResult.ExecutionPayload.StateRoot.Bytes(), payloadResult.ExecutionPayload.GasUsed, nil }