diff --git a/.mockery.yaml b/.mockery.yaml new file mode 100644 index 0000000..9873dbf --- /dev/null +++ b/.mockery.yaml @@ -0,0 +1,8 @@ +with-expecter: true +packages: + github.com/LastL2/execution: + interfaces: + Execute: + config: + dir: mocks + outpkg: mocks diff --git a/Makefile b/Makefile index 9c668cc..4fa4769 100644 --- a/Makefile +++ b/Makefile @@ -65,15 +65,28 @@ test: vet @go test -v -race -covermode=atomic -coverprofile=coverage.txt $(pkgs) -run $(run) -count=$(count) .PHONY: test -### proto-gen: Generate protobuf files. Requires docker. -#proto-gen: -# @echo "--> Generating Protobuf files" -# ./proto/get_deps.sh -# ./proto/gen.sh -#.PHONY: proto-gen -# -### proto-lint: Lint protobuf files. Requires docker. -#proto-lint: -# @echo "--> Linting Protobuf files" -# @$(DOCKER_BUF) lint --error-format=json -#.PHONY: proto-lint +protoVer=0.14.0 +protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) +protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) + +proto-all: proto-format proto-lint proto-gen + +proto-gen: + @echo "Generating protobuf files..." + @$(protoImage) sh ./scripts/protocgen.sh + @go mod tidy + +proto-format: + @$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \; + +proto-lint: + @$(protoImage) buf lint proto/ --error-format=json + +.PHONY: proto-all proto-gen proto-format proto-lint + +## mock-gen: Re-generates DA mock +mock-gen: mocks/Execute.go +.PHONY: mock-gen + +mocks/Execute.go: execution.go .mockery.yaml + @mockery \ No newline at end of file diff --git a/buf.lock b/buf.lock new file mode 100644 index 0000000..6bce5f5 --- /dev/null +++ b/buf.lock @@ -0,0 +1,8 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: gogo-proto + commit: 88ef6483f90f478fb938c37dde52ece3 + digest: shake256:89c45df2aa11e0cff97b0d695436713db3d993d76792e9f8dc1ae90e6ab9a9bec55503d48ceedd6b86069ab07d3041b32001b2bfe0227fa725dd515ff381e5ba diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 0000000..405aef9 --- /dev/null +++ b/buf.yaml @@ -0,0 +1,28 @@ +version: v1beta1 +deps: + - buf.build/cosmos/gogo-proto +build: + roots: + - proto + - third_party/proto +lint: + use: + - STANDARD + - COMMENTS + - FILE_LOWER_SNAKE_CASE + except: + - COMMENT_ENUM + - COMMENT_ENUM_VALUE + - COMMENT_MESSAGE + - COMMENT_RPC + - COMMENT_SERVICE + - COMMENT_FIELD + - PACKAGE_VERSION_SUFFIX + - RPC_REQUEST_STANDARD_NAME + - SERVICE_SUFFIX + - UNARY_RPC + ignore: + - tendermint +breaking: + use: + - FILE diff --git a/execution.go b/execution.go new file mode 100644 index 0000000..b8453c0 --- /dev/null +++ b/execution.go @@ -0,0 +1,41 @@ +package execution + +import ( + "time" + + "github.com/rollkit/rollkit/types" +) + +// Execute defines a common interface for interacting with the execution client. +type Execute interface { + // InitChain initializes the blockchain with genesis information. + InitChain( + genesisTime time.Time, + initialHeight uint64, + chainID string, + ) ( + stateRoot types.Hash, + maxBytes uint64, + err error, + ) + + // GetTxs retrieves all available transactions from the execution client's mempool. + GetTxs() ([]types.Tx, error) + + // ExecuteTxs executes a set of transactions to produce a new block header. + ExecuteTxs( + txs []types.Tx, + blockHeight uint64, + timestamp time.Time, + prevStateRoot types.Hash, + ) ( + updatedStateRoot types.Hash, + maxBytes uint64, + err error, + ) + + // SetFinal marks a block at the given height as final. + SetFinal( + blockHeight uint64, + ) error +} diff --git a/go.mod b/go.mod index 77d492d..a25712e 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,86 @@ -module github.com/rollkit/template-da-repo +module github.com/rollkit/go-execution -go 1.21.0 +go 1.22 + +toolchain go1.22.4 + +require ( + github.com/cosmos/gogoproto v1.5.0 + github.com/rollkit/rollkit v0.13.7 + github.com/stretchr/testify v1.9.0 + google.golang.org/grpc v1.65.0 +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.3 // 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/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // 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/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/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.4 // indirect + github.com/google/btree v1.1.2 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // 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/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/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/spaolacci/murmur3 v1.1.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // 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/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/protobuf v1.34.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + lukechampine.com/blake3 v1.2.1 // indirect +) + +// Add other dependencies as needed diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..6e19158 --- /dev/null +++ b/go.sum @@ -0,0 +1,448 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +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/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= +github.com/btcsuite/btcd/btcec/v2 v2.3.3/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/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/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/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +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/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/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/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-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/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +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 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/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/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/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/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/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-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/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/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.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/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/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/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/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +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/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/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.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/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/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +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-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= +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.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.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/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-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= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +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/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= diff --git a/mocks/mock_Execute.go b/mocks/mock_Execute.go new file mode 100644 index 0000000..1cffd3f --- /dev/null +++ b/mocks/mock_Execute.go @@ -0,0 +1,276 @@ +// Code generated by mockery v2.46.3. DO NOT EDIT. + +package mocks + +import ( + time "time" + + mock "github.com/stretchr/testify/mock" + + types "github.com/rollkit/rollkit/types" +) + +// MockExecute is an autogenerated mock type for the Execute type +type MockExecute struct { + mock.Mock +} + +type MockExecute_Expecter struct { + mock *mock.Mock +} + +func (_m *MockExecute) EXPECT() *MockExecute_Expecter { + return &MockExecute_Expecter{mock: &_m.Mock} +} + +// ExecuteTxs provides a mock function with given fields: txs, blockHeight, timestamp, prevStateRoot +func (_m *MockExecute) ExecuteTxs(txs []types.Tx, blockHeight uint64, timestamp time.Time, prevStateRoot types.Hash) (types.Hash, uint64, error) { + ret := _m.Called(txs, blockHeight, timestamp, prevStateRoot) + + if len(ret) == 0 { + panic("no return value specified for ExecuteTxs") + } + + var r0 types.Hash + var r1 uint64 + var r2 error + if rf, ok := ret.Get(0).(func([]types.Tx, uint64, time.Time, types.Hash) (types.Hash, uint64, error)); ok { + return rf(txs, blockHeight, timestamp, prevStateRoot) + } + if rf, ok := ret.Get(0).(func([]types.Tx, uint64, time.Time, types.Hash) types.Hash); ok { + r0 = rf(txs, blockHeight, timestamp, prevStateRoot) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.Hash) + } + } + + if rf, ok := ret.Get(1).(func([]types.Tx, uint64, time.Time, types.Hash) uint64); ok { + r1 = rf(txs, blockHeight, timestamp, prevStateRoot) + } else { + r1 = ret.Get(1).(uint64) + } + + if rf, ok := ret.Get(2).(func([]types.Tx, uint64, time.Time, types.Hash) error); ok { + r2 = rf(txs, blockHeight, timestamp, prevStateRoot) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// MockExecute_ExecuteTxs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecuteTxs' +type MockExecute_ExecuteTxs_Call struct { + *mock.Call +} + +// ExecuteTxs is a helper method to define mock.On call +// - txs []types.Tx +// - blockHeight uint64 +// - timestamp time.Time +// - prevStateRoot types.Hash +func (_e *MockExecute_Expecter) ExecuteTxs(txs interface{}, blockHeight interface{}, timestamp interface{}, prevStateRoot interface{}) *MockExecute_ExecuteTxs_Call { + return &MockExecute_ExecuteTxs_Call{Call: _e.mock.On("ExecuteTxs", txs, blockHeight, timestamp, prevStateRoot)} +} + +func (_c *MockExecute_ExecuteTxs_Call) Run(run func(txs []types.Tx, blockHeight uint64, timestamp time.Time, prevStateRoot types.Hash)) *MockExecute_ExecuteTxs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]types.Tx), args[1].(uint64), args[2].(time.Time), args[3].(types.Hash)) + }) + return _c +} + +func (_c *MockExecute_ExecuteTxs_Call) Return(_a0 types.Hash, _a1 uint64, _a2 error) *MockExecute_ExecuteTxs_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *MockExecute_ExecuteTxs_Call) RunAndReturn(run func([]types.Tx, uint64, time.Time, types.Hash) (types.Hash, uint64, error)) *MockExecute_ExecuteTxs_Call { + _c.Call.Return(run) + return _c +} + +// GetTxs provides a mock function with given fields: +func (_m *MockExecute) GetTxs() ([]types.Tx, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetTxs") + } + + var r0 []types.Tx + var r1 error + if rf, ok := ret.Get(0).(func() ([]types.Tx, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []types.Tx); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.Tx) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExecute_GetTxs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTxs' +type MockExecute_GetTxs_Call struct { + *mock.Call +} + +// GetTxs is a helper method to define mock.On call +func (_e *MockExecute_Expecter) GetTxs() *MockExecute_GetTxs_Call { + return &MockExecute_GetTxs_Call{Call: _e.mock.On("GetTxs")} +} + +func (_c *MockExecute_GetTxs_Call) Run(run func()) *MockExecute_GetTxs_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockExecute_GetTxs_Call) Return(_a0 []types.Tx, _a1 error) *MockExecute_GetTxs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExecute_GetTxs_Call) RunAndReturn(run func() ([]types.Tx, error)) *MockExecute_GetTxs_Call { + _c.Call.Return(run) + return _c +} + +// InitChain provides a mock function with given fields: genesisTime, initialHeight, chainID +func (_m *MockExecute) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (types.Hash, uint64, error) { + ret := _m.Called(genesisTime, initialHeight, chainID) + + if len(ret) == 0 { + panic("no return value specified for InitChain") + } + + var r0 types.Hash + var r1 uint64 + var r2 error + if rf, ok := ret.Get(0).(func(time.Time, uint64, string) (types.Hash, uint64, error)); ok { + return rf(genesisTime, initialHeight, chainID) + } + if rf, ok := ret.Get(0).(func(time.Time, uint64, string) types.Hash); ok { + r0 = rf(genesisTime, initialHeight, chainID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.Hash) + } + } + + if rf, ok := ret.Get(1).(func(time.Time, uint64, string) uint64); ok { + r1 = rf(genesisTime, initialHeight, chainID) + } else { + r1 = ret.Get(1).(uint64) + } + + if rf, ok := ret.Get(2).(func(time.Time, uint64, string) error); ok { + r2 = rf(genesisTime, initialHeight, chainID) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// MockExecute_InitChain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InitChain' +type MockExecute_InitChain_Call struct { + *mock.Call +} + +// InitChain is a helper method to define mock.On call +// - genesisTime time.Time +// - initialHeight uint64 +// - chainID string +func (_e *MockExecute_Expecter) InitChain(genesisTime interface{}, initialHeight interface{}, chainID interface{}) *MockExecute_InitChain_Call { + return &MockExecute_InitChain_Call{Call: _e.mock.On("InitChain", genesisTime, initialHeight, chainID)} +} + +func (_c *MockExecute_InitChain_Call) Run(run func(genesisTime time.Time, initialHeight uint64, chainID string)) *MockExecute_InitChain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(time.Time), args[1].(uint64), args[2].(string)) + }) + return _c +} + +func (_c *MockExecute_InitChain_Call) Return(_a0 types.Hash, _a1 uint64, _a2 error) *MockExecute_InitChain_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *MockExecute_InitChain_Call) RunAndReturn(run func(time.Time, uint64, string) (types.Hash, uint64, error)) *MockExecute_InitChain_Call { + _c.Call.Return(run) + return _c +} + +// SetFinal provides a mock function with given fields: blockHeight +func (_m *MockExecute) SetFinal(blockHeight uint64) error { + ret := _m.Called(blockHeight) + + if len(ret) == 0 { + panic("no return value specified for SetFinal") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint64) error); ok { + r0 = rf(blockHeight) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockExecute_SetFinal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetFinal' +type MockExecute_SetFinal_Call struct { + *mock.Call +} + +// SetFinal is a helper method to define mock.On call +// - blockHeight uint64 +func (_e *MockExecute_Expecter) SetFinal(blockHeight interface{}) *MockExecute_SetFinal_Call { + return &MockExecute_SetFinal_Call{Call: _e.mock.On("SetFinal", blockHeight)} +} + +func (_c *MockExecute_SetFinal_Call) Run(run func(blockHeight uint64)) *MockExecute_SetFinal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64)) + }) + return _c +} + +func (_c *MockExecute_SetFinal_Call) Return(_a0 error) *MockExecute_SetFinal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockExecute_SetFinal_Call) RunAndReturn(run func(uint64) error) *MockExecute_SetFinal_Call { + _c.Call.Return(run) + return _c +} + +// NewMockExecute creates a new instance of MockExecute. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockExecute(t interface { + mock.TestingT + Cleanup(func()) +}) *MockExecute { + mock := &MockExecute{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/proto/buf.gen.gogo.yaml b/proto/buf.gen.gogo.yaml new file mode 100644 index 0000000..6e1acd3 --- /dev/null +++ b/proto/buf.gen.gogo.yaml @@ -0,0 +1,16 @@ +version: v1beta1 + +# The plugins to run. +plugins: + # The name of the plugin. + - name: + gocosmos + # The the relative output directory. + out: types/pb + # Any options to provide to the plugin. + opt: + - Mgoogle/protobuf/timestamp.proto=github.com/cosmos/gogoproto/types + - Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration + - Mgoogle/protobuf/wrappers.proto=github.com/cosmos/gogoproto/types + - plugins=grpc + - paths=source_relative diff --git a/proto/execution/execution.proto b/proto/execution/execution.proto new file mode 100644 index 0000000..c30ec52 --- /dev/null +++ b/proto/execution/execution.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; +package execution; + +option go_package = "github.com/LastL2/types/pb/execution"; + +service ExecutionService { + rpc InitChain(InitChainRequest) returns (InitChainResponse) {} + rpc GetTxs(GetTxsRequest) returns (GetTxsResponse) {} + rpc ExecuteTxs(ExecuteTxsRequest) returns (ExecuteTxsResponse) {} + rpc SetFinal(SetFinalRequest) returns (SetFinalResponse) {} +} + +message InitChainRequest { + int64 genesis_time = 1; + uint64 initial_height = 2; + string chain_id = 3; +} + +message InitChainResponse { + bytes state_root = 1; + uint64 max_bytes = 2; +} + +message GetTxsRequest {} + +message GetTxsResponse { + repeated bytes txs = 1; +} + +message ExecuteTxsRequest { + repeated bytes txs = 1; + uint64 block_height = 2; + int64 timestamp = 3; + bytes prev_state_root = 4; +} + +message ExecuteTxsResponse { + bytes updated_state_root = 1; + uint64 max_bytes = 2; +} + +message SetFinalRequest { + uint64 block_height = 1; +} + +message SetFinalResponse {} diff --git a/proxy/grpc/client.go b/proxy/grpc/client.go new file mode 100644 index 0000000..689f9cb --- /dev/null +++ b/proxy/grpc/client.go @@ -0,0 +1,117 @@ +package grpc + +import ( + "context" + "time" + + "github.com/rollkit/rollkit/types" + "google.golang.org/grpc" + + pb "github.com/rollkit/go-execution/types" +) + +type Client struct { + conn *grpc.ClientConn + client pb.ExecutionServiceClient + config *Config +} + +func NewClient() *Client { + return &Client{ + config: DefaultConfig(), + } +} + +func (c *Client) SetConfig(config *Config) { + if config != nil { + c.config = config + } +} + +func (c *Client) Start(target string, opts ...grpc.DialOption) error { + var err error + c.conn, err = grpc.Dial(target, opts...) // Changed from grpc.NewClient to grpc.Dial + if err != nil { + return err + } + c.client = pb.NewExecutionServiceClient(c.conn) + return nil +} + +func (c *Client) Stop() error { + if c.conn != nil { + return c.conn.Close() + } + return nil +} + +func (c *Client) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (types.Hash, uint64, error) { + ctx, cancel := context.WithTimeout(context.Background(), c.config.DefaultTimeout) + defer cancel() + + resp, err := c.client.InitChain(ctx, &pb.InitChainRequest{ + GenesisTime: genesisTime.Unix(), + InitialHeight: initialHeight, + ChainId: chainID, + }) + if err != nil { + return types.Hash{}, 0, err + } + + var stateRoot types.Hash + copy(stateRoot[:], resp.StateRoot) + + return stateRoot, resp.MaxBytes, nil +} + +func (c *Client) GetTxs() ([]types.Tx, error) { + ctx, cancel := context.WithTimeout(context.Background(), c.config.DefaultTimeout) + defer cancel() + + resp, err := c.client.GetTxs(ctx, &pb.GetTxsRequest{}) + if err != nil { + return nil, err + } + + txs := make([]types.Tx, len(resp.Txs)) + for i, tx := range resp.Txs { + txs[i] = tx + } + + return txs, nil +} + +func (c *Client) ExecuteTxs(txs []types.Tx, blockHeight uint64, timestamp time.Time, prevStateRoot types.Hash) (types.Hash, uint64, error) { + ctx, cancel := context.WithTimeout(context.Background(), c.config.DefaultTimeout) + defer cancel() + + req := &pb.ExecuteTxsRequest{ + Txs: make([][]byte, len(txs)), + BlockHeight: blockHeight, + Timestamp: timestamp.Unix(), + PrevStateRoot: prevStateRoot[:], + } + for i, tx := range txs { + req.Txs[i] = tx + } + + resp, err := c.client.ExecuteTxs(ctx, req) + if err != nil { + return types.Hash{}, 0, err + } + + var updatedStateRoot types.Hash + copy(updatedStateRoot[:], resp.UpdatedStateRoot) + + return updatedStateRoot, resp.MaxBytes, nil +} + +func (c *Client) SetFinal(blockHeight uint64) error { + ctx, cancel := context.WithTimeout(context.Background(), c.config.DefaultTimeout) + defer cancel() + + _, err := c.client.SetFinal(ctx, &pb.SetFinalRequest{ + BlockHeight: blockHeight, + }) + return err +} diff --git a/proxy/grpc/client_server_test.go b/proxy/grpc/client_server_test.go new file mode 100644 index 0000000..a59d27c --- /dev/null +++ b/proxy/grpc/client_server_test.go @@ -0,0 +1,77 @@ +package grpc_test + +import ( + "testing" + "time" + + "github.com/rollkit/rollkit/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/test/bufconn" + + "github.com/rollkit/go-execution/mocks" + grpcproxy "github.com/rollkit/go-execution/proxy/grpc" + pb "github.com/rollkit/go-execution/types" +) + +func TestClientServer(t *testing.T) { + mockExec := mocks.NewMockExecute(t) + config := &grpcproxy.Config{ + DefaultTimeout: 5 * time.Second, + MaxRequestSize: bufSize, + } + server := grpcproxy.NewServer(mockExec, config) + + listener := bufconn.Listen(bufSize) + s := grpc.NewServer() + pb.RegisterExecutionServiceServer(s, server) + + go func() { + if err := s.Serve(listener); err != nil && err != grpc.ErrServerStopped { + t.Errorf("Server exited with error: %v", err) + } + }() + defer s.Stop() + + client := grpcproxy.NewClient() + client.SetConfig(config) + + err := client.Start("bufnet", + grpc.WithContextDialer(dialer(listener)), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + require.NoError(t, err) + defer client.Stop() + + mockExec.On("GetTxs").Return([]types.Tx{}, nil).Maybe() + + t.Run("InitChain", func(t *testing.T) { + genesisTime := time.Now().UTC().Truncate(time.Second) + initialHeight := uint64(1) + chainID := "test-chain" + + // initialize a new Hash with a fixed size + expectedStateRoot := make([]byte, 32) + copy(expectedStateRoot, []byte{1, 2, 3}) + var stateRootHash types.Hash + copy(stateRootHash[:], expectedStateRoot) + + expectedMaxBytes := uint64(1000000) + + // convert time to Unix and back to ensure consistency + unixTime := genesisTime.Unix() + expectedTime := time.Unix(unixTime, 0).UTC() + + mockExec.On("InitChain", expectedTime, initialHeight, chainID). + Return(stateRootHash, expectedMaxBytes, nil).Once() + + stateRoot, maxBytes, err := client.InitChain(genesisTime, initialHeight, chainID) + + require.NoError(t, err) + assert.Equal(t, stateRootHash, stateRoot) + assert.Equal(t, expectedMaxBytes, maxBytes) + mockExec.AssertExpectations(t) + }) +} diff --git a/proxy/grpc/config.go b/proxy/grpc/config.go new file mode 100644 index 0000000..0c6a9a1 --- /dev/null +++ b/proxy/grpc/config.go @@ -0,0 +1,16 @@ +package grpc + +import "time" + +type Config struct { + JWTSecret []byte + DefaultTimeout time.Duration + MaxRequestSize int +} + +func DefaultConfig() *Config { + return &Config{ + DefaultTimeout: time.Second, + MaxRequestSize: 1024 * 1024, + } +} diff --git a/proxy/grpc/errors.go b/proxy/grpc/errors.go new file mode 100644 index 0000000..03cc9b8 --- /dev/null +++ b/proxy/grpc/errors.go @@ -0,0 +1,15 @@ +package grpc + +import ( + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var ( + ErrUnknownPayload = status.Error(codes.NotFound, "payload does not exist") + ErrInvalidForkchoice = status.Error(codes.InvalidArgument, "invalid forkchoice state") + ErrInvalidPayloadAttrs = status.Error(codes.InvalidArgument, "invalid payload attributes") + ErrTooLargeRequest = status.Error(codes.ResourceExhausted, "request too large") + ErrUnsupportedFork = status.Error(codes.Unimplemented, "unsupported fork") + ErrInvalidJWT = status.Error(codes.Unauthenticated, "invalid JWT token") +) diff --git a/proxy/grpc/proxy_test.go b/proxy/grpc/proxy_test.go new file mode 100644 index 0000000..7f72b03 --- /dev/null +++ b/proxy/grpc/proxy_test.go @@ -0,0 +1,88 @@ +package grpc_test + +import ( + "context" + "net" + "testing" + "time" + + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/test/bufconn" + + grpcproxy "github.com/rollkit/go-execution/proxy/grpc" + "github.com/rollkit/go-execution/test" + pb "github.com/rollkit/go-execution/types" +) + +const bufSize = 1024 * 1024 + +func dialer(listener *bufconn.Listener) func(context.Context, string) (net.Conn, error) { + return func(context.Context, string) (net.Conn, error) { + return listener.Dial() + } +} + +type ProxyTestSuite struct { + test.ExecuteSuite + server *grpc.Server + client *grpcproxy.Client + cleanup func() +} + +func (s *ProxyTestSuite) SetupTest() { + exec := test.NewExecute() + config := &grpcproxy.Config{ + DefaultTimeout: time.Second, + MaxRequestSize: bufSize, + } + server := grpcproxy.NewServer(exec, config) + + listener := bufconn.Listen(bufSize) + s.server = grpc.NewServer() + pb.RegisterExecutionServiceServer(s.server, server) + + go func() { + if err := s.server.Serve(listener); err != nil && err != grpc.ErrServerStopped { + s.T().Errorf("Server exited with error: %v", err) + } + }() + + client := grpcproxy.NewClient() + client.SetConfig(config) + + _, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + + opts := []grpc.DialOption{ + grpc.WithContextDialer(dialer(listener)), + grpc.WithTransportCredentials(insecure.NewCredentials()), + } + + err := client.Start("bufnet", opts...) + require.NoError(s.T(), err) + + for i := 0; i < 10; i++ { + if _, err := client.GetTxs(); err == nil { + break + } + time.Sleep(100 * time.Millisecond) + } + + s.client = client + s.Exec = client + s.cleanup = func() { + client.Stop() + s.server.Stop() + } +} + +func (s *ProxyTestSuite) TearDownTest() { + s.cleanup() +} + +func TestProxySuite(t *testing.T) { + suite.Run(t, new(ProxyTestSuite)) +} diff --git a/proxy/grpc/server.go b/proxy/grpc/server.go new file mode 100644 index 0000000..a524841 --- /dev/null +++ b/proxy/grpc/server.go @@ -0,0 +1,111 @@ +package grpc + +import ( + "context" + "time" + + "github.com/rollkit/go-execution" + pb "github.com/rollkit/go-execution/types" + "github.com/rollkit/rollkit/types" +) + +type Server struct { + pb.UnimplementedExecutionServiceServer + exec execution.Execute + config *Config +} + +func NewServer(exec execution.Execute, config *Config) pb.ExecutionServiceServer { + if config == nil { + config = DefaultConfig() + } + return &Server{ + exec: exec, + config: config, + } +} + +func (s *Server) validateAuth(ctx context.Context) error { + if s.config.JWTSecret != nil { + return s.validateJWT(ctx) + } + return nil +} + +// TO-DO +func (s *Server) validateJWT(_ context.Context) error { + return nil +} + +func (s *Server) InitChain(ctx context.Context, req *pb.InitChainRequest) (*pb.InitChainResponse, error) { + if err := s.validateAuth(ctx); err != nil { + return nil, err + } + + // Convert Unix timestamp to UTC time + genesisTime := time.Unix(req.GenesisTime, 0).UTC() + + stateRoot, maxBytes, err := s.exec.InitChain( + genesisTime, + req.InitialHeight, + req.ChainId, + ) + if err != nil { + return nil, err + } + + return &pb.InitChainResponse{ + StateRoot: stateRoot[:], + MaxBytes: maxBytes, + }, nil +} + +func (s *Server) GetTxs(ctx context.Context, req *pb.GetTxsRequest) (*pb.GetTxsResponse, error) { + txs, err := s.exec.GetTxs() + if err != nil { + return nil, err + } + + pbTxs := make([][]byte, len(txs)) + for i, tx := range txs { + pbTxs[i] = tx + } + + return &pb.GetTxsResponse{ + Txs: pbTxs, + }, nil +} + +func (s *Server) ExecuteTxs(ctx context.Context, req *pb.ExecuteTxsRequest) (*pb.ExecuteTxsResponse, error) { + txs := make([]types.Tx, len(req.Txs)) + for i, tx := range req.Txs { + txs[i] = tx + } + + var prevStateRoot types.Hash + copy(prevStateRoot[:], req.PrevStateRoot) + + updatedStateRoot, maxBytes, err := s.exec.ExecuteTxs( + txs, + req.BlockHeight, + time.Unix(req.Timestamp, 0), + prevStateRoot, + ) + if err != nil { + return nil, err + } + + return &pb.ExecuteTxsResponse{ + UpdatedStateRoot: updatedStateRoot[:], + MaxBytes: maxBytes, + }, nil +} + +func (s *Server) SetFinal(ctx context.Context, req *pb.SetFinalRequest) (*pb.SetFinalResponse, error) { + err := s.exec.SetFinal(req.BlockHeight) + if err != nil { + return nil, err + } + + return &pb.SetFinalResponse{}, nil +} diff --git a/proxy/jsonrpc/client.go b/proxy/jsonrpc/client.go new file mode 100644 index 0000000..0a29914 --- /dev/null +++ b/proxy/jsonrpc/client.go @@ -0,0 +1,189 @@ +package jsonrpc + +import ( + "bytes" + "context" + "encoding/base64" + "encoding/json" + "fmt" + "net/http" + "time" + + "github.com/rollkit/rollkit/types" +) + +type Client struct { + endpoint string + client *http.Client + config *Config +} + +func NewClient() *Client { + return &Client{ + config: DefaultConfig(), + client: &http.Client{}, + } +} + +func (c *Client) SetConfig(config *Config) { + if config != nil { + c.config = config + c.client.Timeout = config.DefaultTimeout + } +} + +func (c *Client) Start(endpoint string) error { + c.endpoint = endpoint + return nil +} + +func (c *Client) Stop() error { + return nil +} + +func (c *Client) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (types.Hash, uint64, error) { + params := map[string]interface{}{ + "genesis_time": genesisTime.Unix(), + "initial_height": initialHeight, + "chain_id": chainID, + } + + var result struct { + StateRoot string `json:"state_root"` + MaxBytes uint64 `json:"max_bytes"` + } + + if err := c.call("init_chain", params, &result); err != nil { + return types.Hash{}, 0, err + } + + stateRootBytes, err := base64.StdEncoding.DecodeString(result.StateRoot) + if err != nil { + return types.Hash{}, 0, fmt.Errorf("failed to decode state root: %w", err) + } + + var stateRoot types.Hash + copy(stateRoot[:], stateRootBytes) + + return stateRoot, result.MaxBytes, nil +} + +func (c *Client) GetTxs() ([]types.Tx, error) { + var result struct { + Txs []string `json:"txs"` + } + + if err := c.call("get_txs", nil, &result); err != nil { + return nil, err + } + + txs := make([]types.Tx, len(result.Txs)) + for i, encodedTx := range result.Txs { + tx, err := base64.StdEncoding.DecodeString(encodedTx) + if err != nil { + return nil, fmt.Errorf("failed to decode tx: %w", err) + } + txs[i] = tx + } + + return txs, nil +} + +func (c *Client) ExecuteTxs(txs []types.Tx, blockHeight uint64, timestamp time.Time, prevStateRoot types.Hash) (types.Hash, uint64, error) { + // Encode txs to base64 + encodedTxs := make([]string, len(txs)) + for i, tx := range txs { + encodedTxs[i] = base64.StdEncoding.EncodeToString(tx) + } + + params := map[string]interface{}{ + "txs": encodedTxs, + "block_height": blockHeight, + "timestamp": timestamp.Unix(), + "prev_state_root": base64.StdEncoding.EncodeToString(prevStateRoot[:]), + } + + var result struct { + UpdatedStateRoot string `json:"updated_state_root"` + MaxBytes uint64 `json:"max_bytes"` + } + + if err := c.call("execute_txs", params, &result); err != nil { + return types.Hash{}, 0, err + } + + updatedStateRootBytes, err := base64.StdEncoding.DecodeString(result.UpdatedStateRoot) + if err != nil { + return types.Hash{}, 0, fmt.Errorf("failed to decode updated state root: %w", err) + } + + var updatedStateRoot types.Hash + copy(updatedStateRoot[:], updatedStateRootBytes) + + return updatedStateRoot, result.MaxBytes, nil +} + +func (c *Client) SetFinal(blockHeight uint64) error { + params := map[string]interface{}{ + "block_height": blockHeight, + } + + return c.call("set_final", params, nil) +} + +func (c *Client) call(method string, params interface{}, result interface{}) error { + request := struct { + JSONRPC string `json:"jsonrpc"` + Method string `json:"method"` + Params interface{} `json:"params,omitempty"` + ID int `json:"id"` + }{ + JSONRPC: "2.0", + Method: method, + Params: params, + ID: 1, + } + + reqBody, err := json.Marshal(request) + if err != nil { + return fmt.Errorf("failed to marshal request: %w", err) + } + + req, err := http.NewRequestWithContext(context.Background(), "POST", c.endpoint, bytes.NewReader(reqBody)) + if err != nil { + return fmt.Errorf("failed to create request: %w", err) + } + + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return fmt.Errorf("failed to send request: %w", err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("unexpected status code: %d", resp.StatusCode) + } + + var jsonRPCResponse struct { + Error *jsonRPCError `json:"error,omitempty"` + Result json.RawMessage `json:"result,omitempty"` + } + + if err := json.NewDecoder(resp.Body).Decode(&jsonRPCResponse); err != nil { + return fmt.Errorf("failed to decode response: %w", err) + } + + if jsonRPCResponse.Error != nil { + return fmt.Errorf("RPC error: %d %s", jsonRPCResponse.Error.Code, jsonRPCResponse.Error.Message) + } + + if result != nil { + if err := json.Unmarshal(jsonRPCResponse.Result, result); err != nil { + return fmt.Errorf("failed to unmarshal result: %w", err) + } + } + + return nil +} diff --git a/proxy/jsonrpc/client_server_test.go b/proxy/jsonrpc/client_server_test.go new file mode 100644 index 0000000..2be6e25 --- /dev/null +++ b/proxy/jsonrpc/client_server_test.go @@ -0,0 +1,107 @@ +package jsonrpc_test + +import ( + "net/http/httptest" + "testing" + "time" + + "github.com/rollkit/rollkit/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/rollkit/go-execution/mocks" + jsonrpcproxy "github.com/rollkit/go-execution/proxy/jsonrpc" +) + +func TestClientServer(t *testing.T) { + mockExec := mocks.NewMockExecute(t) + config := &jsonrpcproxy.Config{ + DefaultTimeout: 5 * time.Second, + MaxRequestSize: 1024 * 1024, + } + server := jsonrpcproxy.NewServer(mockExec, config) + + testServer := httptest.NewServer(server) + defer testServer.Close() + + client := jsonrpcproxy.NewClient() + client.SetConfig(config) + + err := client.Start(testServer.URL) + require.NoError(t, err) + defer client.Stop() + + t.Run("InitChain", func(t *testing.T) { + genesisTime := time.Now().UTC().Truncate(time.Second) + initialHeight := uint64(1) + chainID := "test-chain" + + expectedStateRoot := make([]byte, 32) + copy(expectedStateRoot, []byte{1, 2, 3}) + var stateRootHash types.Hash + copy(stateRootHash[:], expectedStateRoot) + + expectedMaxBytes := uint64(1000000) + + // convert time to Unix and back to ensure consistency + unixTime := genesisTime.Unix() + expectedTime := time.Unix(unixTime, 0).UTC() + + mockExec.On("InitChain", expectedTime, initialHeight, chainID). + Return(stateRootHash, expectedMaxBytes, nil).Once() + + stateRoot, maxBytes, err := client.InitChain(genesisTime, initialHeight, chainID) + + require.NoError(t, err) + assert.Equal(t, stateRootHash, stateRoot) + assert.Equal(t, expectedMaxBytes, maxBytes) + mockExec.AssertExpectations(t) + }) + + t.Run("GetTxs", func(t *testing.T) { + expectedTxs := []types.Tx{[]byte("tx1"), []byte("tx2")} + mockExec.On("GetTxs").Return(expectedTxs, nil).Once() + + txs, err := client.GetTxs() + require.NoError(t, err) + assert.Equal(t, expectedTxs, txs) + mockExec.AssertExpectations(t) + }) + + t.Run("ExecuteTxs", func(t *testing.T) { + txs := []types.Tx{[]byte("tx1"), []byte("tx2")} + blockHeight := uint64(1) + timestamp := time.Now().UTC().Truncate(time.Second) + + var prevStateRoot types.Hash + copy(prevStateRoot[:], []byte{1, 2, 3}) + + var expectedStateRoot types.Hash + copy(expectedStateRoot[:], []byte{4, 5, 6}) + + expectedMaxBytes := uint64(1000000) + + // convert time to Unix and back to ensure consistency + unixTime := timestamp.Unix() + expectedTime := time.Unix(unixTime, 0).UTC() + + mockExec.On("ExecuteTxs", txs, blockHeight, expectedTime, prevStateRoot). + Return(expectedStateRoot, expectedMaxBytes, nil).Once() + + updatedStateRoot, maxBytes, err := client.ExecuteTxs(txs, blockHeight, timestamp, prevStateRoot) + + require.NoError(t, err) + assert.Equal(t, expectedStateRoot, updatedStateRoot) + assert.Equal(t, expectedMaxBytes, maxBytes) + mockExec.AssertExpectations(t) + }) + + t.Run("SetFinal", func(t *testing.T) { + blockHeight := uint64(1) + mockExec.On("SetFinal", blockHeight).Return(nil).Once() + + err := client.SetFinal(blockHeight) + require.NoError(t, err) + mockExec.AssertExpectations(t) + }) +} diff --git a/proxy/jsonrpc/config.go b/proxy/jsonrpc/config.go new file mode 100644 index 0000000..bfe2b7a --- /dev/null +++ b/proxy/jsonrpc/config.go @@ -0,0 +1,15 @@ +package jsonrpc + +import "time" + +type Config struct { + DefaultTimeout time.Duration + MaxRequestSize int64 +} + +func DefaultConfig() *Config { + return &Config{ + DefaultTimeout: time.Second, + MaxRequestSize: 1024 * 1024, // 1MB + } +} diff --git a/proxy/jsonrpc/errors.go b/proxy/jsonrpc/errors.go new file mode 100644 index 0000000..e5ac4c8 --- /dev/null +++ b/proxy/jsonrpc/errors.go @@ -0,0 +1,22 @@ +package jsonrpc + +type jsonRPCError struct { + Code int `json:"code"` + Message string `json:"message"` +} + +const ( + ErrCodeParse = -32700 + ErrCodeInvalidRequest = -32600 + ErrCodeMethodNotFound = -32601 + ErrCodeInvalidParams = -32602 + ErrCodeInternal = -32603 +) + +var ( + ErrParse = &jsonRPCError{Code: ErrCodeParse, Message: "Parse error"} + ErrInvalidRequest = &jsonRPCError{Code: ErrCodeInvalidRequest, Message: "Invalid request"} + ErrMethodNotFound = &jsonRPCError{Code: ErrCodeMethodNotFound, Message: "Method not found"} + ErrInvalidParams = &jsonRPCError{Code: ErrCodeInvalidParams, Message: "Invalid params"} + ErrInternal = &jsonRPCError{Code: ErrCodeInternal, Message: "Internal error"} +) diff --git a/proxy/jsonrpc/proxy_test.go b/proxy/jsonrpc/proxy_test.go new file mode 100644 index 0000000..e7c8201 --- /dev/null +++ b/proxy/jsonrpc/proxy_test.go @@ -0,0 +1,52 @@ +package jsonrpc_test + +import ( + "net/http/httptest" + "testing" + "time" + + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + jsonrpcproxy "github.com/rollkit/go-execution/proxy/jsonrpc" + "github.com/rollkit/go-execution/test" +) + +type ProxyTestSuite struct { + test.ExecuteSuite + server *httptest.Server + client *jsonrpcproxy.Client + cleanup func() +} + +func (s *ProxyTestSuite) SetupTest() { + exec := test.NewExecute() + config := &jsonrpcproxy.Config{ + DefaultTimeout: time.Second, + MaxRequestSize: 1024 * 1024, + } + server := jsonrpcproxy.NewServer(exec, config) + + s.server = httptest.NewServer(server) + + client := jsonrpcproxy.NewClient() + client.SetConfig(config) + + err := client.Start(s.server.URL) + require.NoError(s.T(), err) + + s.client = client + s.Exec = client + s.cleanup = func() { + client.Stop() + s.server.Close() + } +} + +func (s *ProxyTestSuite) TearDownTest() { + s.cleanup() +} + +func TestProxySuite(t *testing.T) { + suite.Run(t, new(ProxyTestSuite)) +} diff --git a/proxy/jsonrpc/server.go b/proxy/jsonrpc/server.go new file mode 100644 index 0000000..04af4d1 --- /dev/null +++ b/proxy/jsonrpc/server.go @@ -0,0 +1,204 @@ +package jsonrpc + +import ( + "encoding/base64" + "encoding/json" + "net/http" + "time" + + "github.com/rollkit/go-execution" + "github.com/rollkit/rollkit/types" +) + +type Server struct { + exec execution.Execute + config *Config +} + +func NewServer(exec execution.Execute, config *Config) *Server { + if config == nil { + config = DefaultConfig() + } + return &Server{ + exec: exec, + config: config, + } +} + +func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + writeError(w, ErrInvalidRequest) + return + } + + if r.ContentLength > s.config.MaxRequestSize { + writeError(w, ErrInvalidRequest) + return + } + + var request struct { + JSONRPC string `json:"jsonrpc"` + Method string `json:"method"` + Params json.RawMessage `json:"params"` + ID interface{} `json:"id"` + } + + if err := json.NewDecoder(r.Body).Decode(&request); err != nil { + writeError(w, ErrParse) + return + } + + if request.JSONRPC != "2.0" { + writeError(w, ErrInvalidRequest) + return + } + + var result interface{} + var err *jsonRPCError + + switch request.Method { + case "init_chain": + result, err = s.handleInitChain(request.Params) + case "get_txs": + result, err = s.handleGetTxs() + case "execute_txs": + result, err = s.handleExecuteTxs(request.Params) + case "set_final": + result, err = s.handleSetFinal(request.Params) + default: + err = ErrMethodNotFound + } + + if err != nil { + writeResponse(w, request.ID, nil, err) + return + } + + writeResponse(w, request.ID, result, nil) +} + +func (s *Server) handleInitChain(params json.RawMessage) (interface{}, *jsonRPCError) { + var p struct { + GenesisTime int64 `json:"genesis_time"` + InitialHeight uint64 `json:"initial_height"` + ChainID string `json:"chain_id"` + } + + if err := json.Unmarshal(params, &p); err != nil { + return nil, ErrInvalidParams + } + + stateRoot, maxBytes, err := s.exec.InitChain( + time.Unix(p.GenesisTime, 0).UTC(), + p.InitialHeight, + p.ChainID, + ) + if err != nil { + return nil, &jsonRPCError{Code: ErrCodeInternal, Message: err.Error()} + } + + return map[string]interface{}{ + "state_root": base64.StdEncoding.EncodeToString(stateRoot[:]), + "max_bytes": maxBytes, + }, nil +} + +func (s *Server) handleGetTxs() (interface{}, *jsonRPCError) { + txs, err := s.exec.GetTxs() + if err != nil { + return nil, &jsonRPCError{Code: ErrCodeInternal, Message: err.Error()} + } + + encodedTxs := make([]string, len(txs)) + for i, tx := range txs { + encodedTxs[i] = base64.StdEncoding.EncodeToString(tx) + } + + return map[string]interface{}{ + "txs": encodedTxs, + }, nil +} + +func (s *Server) handleExecuteTxs(params json.RawMessage) (interface{}, *jsonRPCError) { + var p struct { + Txs []string `json:"txs"` + BlockHeight uint64 `json:"block_height"` + Timestamp int64 `json:"timestamp"` + PrevStateRoot string `json:"prev_state_root"` + } + + if err := json.Unmarshal(params, &p); err != nil { + return nil, ErrInvalidParams + } + + // Decode base64 txs + txs := make([]types.Tx, len(p.Txs)) + for i, encodedTx := range p.Txs { + tx, err := base64.StdEncoding.DecodeString(encodedTx) + if err != nil { + return nil, ErrInvalidParams + } + txs[i] = tx + } + + // Decode base64 prev state root + prevStateRootBytes, err := base64.StdEncoding.DecodeString(p.PrevStateRoot) + if err != nil { + return nil, ErrInvalidParams + } + + var prevStateRoot types.Hash + copy(prevStateRoot[:], prevStateRootBytes) + + updatedStateRoot, maxBytes, err := s.exec.ExecuteTxs( + txs, + p.BlockHeight, + time.Unix(p.Timestamp, 0).UTC(), + prevStateRoot, + ) + if err != nil { + return nil, &jsonRPCError{Code: ErrCodeInternal, Message: err.Error()} + } + + return map[string]interface{}{ + "updated_state_root": base64.StdEncoding.EncodeToString(updatedStateRoot[:]), + "max_bytes": maxBytes, + }, nil +} + +func (s *Server) handleSetFinal(params json.RawMessage) (interface{}, *jsonRPCError) { + var p struct { + BlockHeight uint64 `json:"block_height"` + } + + if err := json.Unmarshal(params, &p); err != nil { + return nil, ErrInvalidParams + } + + if err := s.exec.SetFinal(p.BlockHeight); err != nil { + return nil, &jsonRPCError{Code: ErrCodeInternal, Message: err.Error()} + } + + return map[string]interface{}{}, nil +} + +func writeError(w http.ResponseWriter, err *jsonRPCError) { + writeResponse(w, nil, nil, err) +} + +func writeResponse(w http.ResponseWriter, id interface{}, result interface{}, err *jsonRPCError) { + response := struct { + JSONRPC string `json:"jsonrpc"` + Result interface{} `json:"result,omitempty"` + Error *jsonRPCError `json:"error,omitempty"` + ID interface{} `json:"id"` + }{ + JSONRPC: "2.0", + Result: result, + Error: err, + ID: id, + } + + w.Header().Set("Content-Type", "application/json") + json.NewEncoder(w).Encode(response) +} diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh new file mode 100644 index 0000000..9be8958 --- /dev/null +++ b/scripts/protocgen.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +echo "Generating gogo proto code" +cd proto +proto_dirs=$(find . -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) +for dir in $proto_dirs; do + for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do + # this regex checks if a proto file has its go_package set to github.com/alice/checkers/api/... + # gogo proto files SHOULD ONLY be generated if this is false + # we don't want gogo proto to run for proto files which are natively built for google.golang.org/protobuf + if grep -q "option go_package" "$file" && grep -H -o -c 'option go_package.*github.com/rollkit/go-execution/api' "$file" | grep -q ':0$'; then + buf generate --template buf.gen.gogo.yaml $file + fi + done +done + +# move to root directory +cd .. +# copy generated gogo proto code to x/ +cp -r proto/types/pb/* types/ +# clean up +rm -rf proto/types diff --git a/test/dummy.go b/test/dummy.go new file mode 100644 index 0000000..0b01cb4 --- /dev/null +++ b/test/dummy.go @@ -0,0 +1,40 @@ +package test + +import ( + "time" + + "github.com/rollkit/rollkit/types" +) + +// Execute is a dummy implementation of the Execute interface for testing +type Execute struct { + stateRoot types.Hash + maxBytes uint64 + txs []types.Tx +} + +// NewExecute creates a new dummy Execute instance +func NewExecute() *Execute { + return &Execute{ + stateRoot: types.Hash{1, 2, 3}, + maxBytes: 1000000, + txs: make([]types.Tx, 0), + } +} + +func (e *Execute) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (types.Hash, uint64, error) { + return e.stateRoot, e.maxBytes, nil +} + +func (e *Execute) GetTxs() ([]types.Tx, error) { + return e.txs, nil +} + +func (e *Execute) ExecuteTxs(txs []types.Tx, blockHeight uint64, timestamp time.Time, prevStateRoot types.Hash) (types.Hash, uint64, error) { + e.txs = append(e.txs, txs...) + return e.stateRoot, e.maxBytes, nil +} + +func (e *Execute) SetFinal(blockHeight uint64) error { + return nil +} diff --git a/test/suite.go b/test/suite.go new file mode 100644 index 0000000..5afcda5 --- /dev/null +++ b/test/suite.go @@ -0,0 +1,64 @@ +package test + +import ( + "testing" + "time" + + "github.com/rollkit/rollkit/types" + "github.com/stretchr/testify/suite" + + "github.com/rollkit/go-execution" +) + +type ExecuteSuite struct { + suite.Suite + Exec execution.Execute +} + +func (s *ExecuteSuite) SetupTest() {} + +func (s *ExecuteSuite) TestInitChain() { + genesisTime := time.Now().UTC() + initialHeight := uint64(1) + chainID := "test-chain" + + stateRoot, maxBytes, err := s.Exec.InitChain(genesisTime, initialHeight, chainID) + s.Require().NoError(err) + s.NotEqual(types.Hash{}, stateRoot) + s.Greater(maxBytes, uint64(0)) +} + +func (s *ExecuteSuite) TestGetTxs() { + txs, err := s.Exec.GetTxs() + s.Require().NoError(err) + s.NotNil(txs) +} + +func (s *ExecuteSuite) TestExecuteTxs() { + txs := []types.Tx{[]byte("tx1"), []byte("tx2")} + blockHeight := uint64(1) + timestamp := time.Now().UTC() + prevStateRoot := types.Hash{1, 2, 3} + + stateRoot, maxBytes, err := s.Exec.ExecuteTxs(txs, blockHeight, timestamp, prevStateRoot) + s.Require().NoError(err) + s.NotEqual(types.Hash{}, stateRoot) + s.Greater(maxBytes, uint64(0)) +} + +func (s *ExecuteSuite) TestSetFinal() { + err := s.Exec.SetFinal(1) + s.Require().NoError(err) +} + +type DummyTestSuite struct { + ExecuteSuite +} + +func (s *DummyTestSuite) SetupTest() { + s.Exec = NewExecute() +} + +func TestDummySuite(t *testing.T) { + suite.Run(t, new(DummyTestSuite)) +} diff --git a/types/execution.pb.go b/types/execution.pb.go new file mode 100644 index 0000000..2e50066 --- /dev/null +++ b/types/execution.pb.go @@ -0,0 +1,1875 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: execution/execution.proto + +package execution + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type InitChainRequest struct { + GenesisTime int64 `protobuf:"varint,1,opt,name=genesis_time,json=genesisTime,proto3" json:"genesis_time,omitempty"` + InitialHeight uint64 `protobuf:"varint,2,opt,name=initial_height,json=initialHeight,proto3" json:"initial_height,omitempty"` + ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +} + +func (m *InitChainRequest) Reset() { *m = InitChainRequest{} } +func (m *InitChainRequest) String() string { return proto.CompactTextString(m) } +func (*InitChainRequest) ProtoMessage() {} +func (*InitChainRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0a4329d6cc9a89db, []int{0} +} +func (m *InitChainRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *InitChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_InitChainRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *InitChainRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_InitChainRequest.Merge(m, src) +} +func (m *InitChainRequest) XXX_Size() int { + return m.Size() +} +func (m *InitChainRequest) XXX_DiscardUnknown() { + xxx_messageInfo_InitChainRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_InitChainRequest proto.InternalMessageInfo + +func (m *InitChainRequest) GetGenesisTime() int64 { + if m != nil { + return m.GenesisTime + } + return 0 +} + +func (m *InitChainRequest) GetInitialHeight() uint64 { + if m != nil { + return m.InitialHeight + } + return 0 +} + +func (m *InitChainRequest) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +type InitChainResponse struct { + StateRoot []byte `protobuf:"bytes,1,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` +} + +func (m *InitChainResponse) Reset() { *m = InitChainResponse{} } +func (m *InitChainResponse) String() string { return proto.CompactTextString(m) } +func (*InitChainResponse) ProtoMessage() {} +func (*InitChainResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0a4329d6cc9a89db, []int{1} +} +func (m *InitChainResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *InitChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_InitChainResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *InitChainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_InitChainResponse.Merge(m, src) +} +func (m *InitChainResponse) XXX_Size() int { + return m.Size() +} +func (m *InitChainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_InitChainResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_InitChainResponse proto.InternalMessageInfo + +func (m *InitChainResponse) GetStateRoot() []byte { + if m != nil { + return m.StateRoot + } + return nil +} + +func (m *InitChainResponse) GetMaxBytes() uint64 { + if m != nil { + return m.MaxBytes + } + return 0 +} + +type GetTxsRequest struct { +} + +func (m *GetTxsRequest) Reset() { *m = GetTxsRequest{} } +func (m *GetTxsRequest) String() string { return proto.CompactTextString(m) } +func (*GetTxsRequest) ProtoMessage() {} +func (*GetTxsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0a4329d6cc9a89db, []int{2} +} +func (m *GetTxsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetTxsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetTxsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetTxsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTxsRequest.Merge(m, src) +} +func (m *GetTxsRequest) XXX_Size() int { + return m.Size() +} +func (m *GetTxsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetTxsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTxsRequest proto.InternalMessageInfo + +type GetTxsResponse struct { + Txs [][]byte `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` +} + +func (m *GetTxsResponse) Reset() { *m = GetTxsResponse{} } +func (m *GetTxsResponse) String() string { return proto.CompactTextString(m) } +func (*GetTxsResponse) ProtoMessage() {} +func (*GetTxsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0a4329d6cc9a89db, []int{3} +} +func (m *GetTxsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetTxsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetTxsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetTxsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTxsResponse.Merge(m, src) +} +func (m *GetTxsResponse) XXX_Size() int { + return m.Size() +} +func (m *GetTxsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetTxsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTxsResponse proto.InternalMessageInfo + +func (m *GetTxsResponse) GetTxs() [][]byte { + if m != nil { + return m.Txs + } + return nil +} + +type ExecuteTxsRequest struct { + Txs [][]byte `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` + BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + PrevStateRoot []byte `protobuf:"bytes,4,opt,name=prev_state_root,json=prevStateRoot,proto3" json:"prev_state_root,omitempty"` +} + +func (m *ExecuteTxsRequest) Reset() { *m = ExecuteTxsRequest{} } +func (m *ExecuteTxsRequest) String() string { return proto.CompactTextString(m) } +func (*ExecuteTxsRequest) ProtoMessage() {} +func (*ExecuteTxsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0a4329d6cc9a89db, []int{4} +} +func (m *ExecuteTxsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExecuteTxsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExecuteTxsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExecuteTxsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExecuteTxsRequest.Merge(m, src) +} +func (m *ExecuteTxsRequest) XXX_Size() int { + return m.Size() +} +func (m *ExecuteTxsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExecuteTxsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ExecuteTxsRequest proto.InternalMessageInfo + +func (m *ExecuteTxsRequest) GetTxs() [][]byte { + if m != nil { + return m.Txs + } + return nil +} + +func (m *ExecuteTxsRequest) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *ExecuteTxsRequest) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + +func (m *ExecuteTxsRequest) GetPrevStateRoot() []byte { + if m != nil { + return m.PrevStateRoot + } + return nil +} + +type ExecuteTxsResponse struct { + UpdatedStateRoot []byte `protobuf:"bytes,1,opt,name=updated_state_root,json=updatedStateRoot,proto3" json:"updated_state_root,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` +} + +func (m *ExecuteTxsResponse) Reset() { *m = ExecuteTxsResponse{} } +func (m *ExecuteTxsResponse) String() string { return proto.CompactTextString(m) } +func (*ExecuteTxsResponse) ProtoMessage() {} +func (*ExecuteTxsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0a4329d6cc9a89db, []int{5} +} +func (m *ExecuteTxsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExecuteTxsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExecuteTxsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExecuteTxsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExecuteTxsResponse.Merge(m, src) +} +func (m *ExecuteTxsResponse) XXX_Size() int { + return m.Size() +} +func (m *ExecuteTxsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExecuteTxsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ExecuteTxsResponse proto.InternalMessageInfo + +func (m *ExecuteTxsResponse) GetUpdatedStateRoot() []byte { + if m != nil { + return m.UpdatedStateRoot + } + return nil +} + +func (m *ExecuteTxsResponse) GetMaxBytes() uint64 { + if m != nil { + return m.MaxBytes + } + return 0 +} + +type SetFinalRequest struct { + BlockHeight uint64 `protobuf:"varint,1,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` +} + +func (m *SetFinalRequest) Reset() { *m = SetFinalRequest{} } +func (m *SetFinalRequest) String() string { return proto.CompactTextString(m) } +func (*SetFinalRequest) ProtoMessage() {} +func (*SetFinalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0a4329d6cc9a89db, []int{6} +} +func (m *SetFinalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetFinalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SetFinalRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SetFinalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetFinalRequest.Merge(m, src) +} +func (m *SetFinalRequest) XXX_Size() int { + return m.Size() +} +func (m *SetFinalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SetFinalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SetFinalRequest proto.InternalMessageInfo + +func (m *SetFinalRequest) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +type SetFinalResponse struct { +} + +func (m *SetFinalResponse) Reset() { *m = SetFinalResponse{} } +func (m *SetFinalResponse) String() string { return proto.CompactTextString(m) } +func (*SetFinalResponse) ProtoMessage() {} +func (*SetFinalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0a4329d6cc9a89db, []int{7} +} +func (m *SetFinalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetFinalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SetFinalResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SetFinalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetFinalResponse.Merge(m, src) +} +func (m *SetFinalResponse) XXX_Size() int { + return m.Size() +} +func (m *SetFinalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SetFinalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SetFinalResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*InitChainRequest)(nil), "execution.InitChainRequest") + proto.RegisterType((*InitChainResponse)(nil), "execution.InitChainResponse") + proto.RegisterType((*GetTxsRequest)(nil), "execution.GetTxsRequest") + proto.RegisterType((*GetTxsResponse)(nil), "execution.GetTxsResponse") + proto.RegisterType((*ExecuteTxsRequest)(nil), "execution.ExecuteTxsRequest") + proto.RegisterType((*ExecuteTxsResponse)(nil), "execution.ExecuteTxsResponse") + proto.RegisterType((*SetFinalRequest)(nil), "execution.SetFinalRequest") + proto.RegisterType((*SetFinalResponse)(nil), "execution.SetFinalResponse") +} + +func init() { proto.RegisterFile("execution/execution.proto", fileDescriptor_0a4329d6cc9a89db) } + +var fileDescriptor_0a4329d6cc9a89db = []byte{ + // 493 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xce, 0x36, 0x55, 0x89, 0xa7, 0x49, 0x93, 0xee, 0x29, 0x71, 0x5a, 0x2b, 0x58, 0x80, 0x72, + 0x40, 0x89, 0x54, 0x38, 0x83, 0x54, 0x14, 0x68, 0x45, 0x25, 0x24, 0xa7, 0x27, 0x2e, 0x96, 0xed, + 0x8c, 0x92, 0x15, 0xb1, 0xd7, 0x64, 0x27, 0xc5, 0x7d, 0x09, 0xc4, 0xab, 0xf0, 0x16, 0x1c, 0x7b, + 0xe4, 0x88, 0x92, 0x17, 0x41, 0x76, 0xfc, 0x97, 0x26, 0x48, 0xdc, 0x76, 0xbf, 0x99, 0xfd, 0x66, + 0xbe, 0x6f, 0x66, 0xa1, 0x83, 0x11, 0x7a, 0x4b, 0x12, 0x32, 0x18, 0xe6, 0xa7, 0x41, 0xb8, 0x90, + 0x24, 0xb9, 0x96, 0x03, 0xe6, 0x37, 0x68, 0x5d, 0x07, 0x82, 0xde, 0xcd, 0x1c, 0x11, 0x58, 0xf8, + 0x75, 0x89, 0x8a, 0xf8, 0x53, 0xa8, 0x4f, 0x31, 0x40, 0x25, 0x94, 0x4d, 0xc2, 0xc7, 0x36, 0xeb, + 0xb1, 0x7e, 0xd5, 0x3a, 0x4e, 0xb1, 0x5b, 0xe1, 0x23, 0x7f, 0x0e, 0x27, 0x22, 0x10, 0x24, 0x9c, + 0xb9, 0x3d, 0x43, 0x31, 0x9d, 0x51, 0xfb, 0xa0, 0xc7, 0xfa, 0x87, 0x56, 0x23, 0x45, 0xaf, 0x12, + 0x90, 0x77, 0xa0, 0xe6, 0xc5, 0xcc, 0xb6, 0x98, 0xb4, 0xab, 0x3d, 0xd6, 0xd7, 0xac, 0x27, 0xc9, + 0xfd, 0x7a, 0x62, 0x7e, 0x82, 0xd3, 0x52, 0x61, 0x15, 0xca, 0x40, 0x21, 0x3f, 0x07, 0x50, 0xe4, + 0x10, 0xda, 0x0b, 0x29, 0x29, 0xa9, 0x5b, 0xb7, 0xb4, 0x04, 0xb1, 0xa4, 0x24, 0xde, 0x05, 0xcd, + 0x77, 0x22, 0xdb, 0xbd, 0x27, 0x54, 0x69, 0xc1, 0x9a, 0xef, 0x44, 0x97, 0xf1, 0xdd, 0x6c, 0x42, + 0xe3, 0x03, 0xd2, 0x6d, 0xa4, 0x52, 0x19, 0xa6, 0x09, 0x27, 0x19, 0x90, 0xd2, 0xb7, 0xa0, 0x4a, + 0x91, 0x6a, 0xb3, 0x5e, 0xb5, 0x5f, 0xb7, 0xe2, 0xa3, 0xf9, 0x9d, 0xc1, 0xe9, 0x28, 0x31, 0x03, + 0x8b, 0x97, 0xbb, 0x79, 0xb1, 0x25, 0xee, 0x5c, 0x7a, 0x5f, 0xb6, 0xd5, 0x1e, 0x27, 0x58, 0xaa, + 0xf5, 0x0c, 0xb4, 0xd8, 0x2d, 0x45, 0x8e, 0x1f, 0x26, 0x62, 0xab, 0x56, 0x01, 0xf0, 0x17, 0xd0, + 0x0c, 0x17, 0x78, 0x67, 0x97, 0xe4, 0x1d, 0x26, 0xf2, 0x1a, 0x31, 0x3c, 0xce, 0x24, 0x9a, 0x36, + 0xf0, 0x72, 0x3f, 0x69, 0xe3, 0x2f, 0x81, 0x2f, 0xc3, 0x89, 0x43, 0x38, 0xb1, 0x77, 0xfc, 0x69, + 0xa5, 0x91, 0xf1, 0xff, 0xd9, 0xf4, 0x1a, 0x9a, 0x63, 0xa4, 0xf7, 0x22, 0x70, 0xe6, 0xa5, 0x79, + 0x6f, 0x89, 0x63, 0x3b, 0xe2, 0x4c, 0x0e, 0xad, 0xe2, 0xd5, 0xa6, 0xa9, 0x8b, 0x9f, 0x07, 0xd0, + 0x1a, 0x65, 0x8b, 0x34, 0xc6, 0xc5, 0x9d, 0xf0, 0x90, 0x5f, 0x81, 0x96, 0x8f, 0x95, 0x77, 0x07, + 0xc5, 0xe6, 0x3d, 0xde, 0x32, 0xfd, 0x6c, 0x7f, 0x70, 0x43, 0x6e, 0x56, 0xf8, 0x5b, 0x38, 0xda, + 0x8c, 0x8f, 0xb7, 0x4b, 0x99, 0x5b, 0x23, 0xd6, 0x3b, 0x7b, 0x22, 0x39, 0xc1, 0x47, 0x80, 0xc2, + 0x4a, 0x5e, 0x2e, 0xb7, 0x33, 0x71, 0xfd, 0xfc, 0x1f, 0xd1, 0x9c, 0x6c, 0x04, 0xb5, 0xcc, 0x00, + 0xae, 0x97, 0x92, 0x1f, 0x79, 0xa9, 0x77, 0xf7, 0xc6, 0x32, 0x9a, 0xcb, 0x37, 0xbf, 0x56, 0x06, + 0x7b, 0x58, 0x19, 0xec, 0xcf, 0xca, 0x60, 0x3f, 0xd6, 0x46, 0xe5, 0x61, 0x6d, 0x54, 0x7e, 0xaf, + 0x8d, 0xca, 0xe7, 0x67, 0x53, 0x41, 0xb3, 0xa5, 0x3b, 0xf0, 0xa4, 0x3f, 0xbc, 0x71, 0x14, 0xdd, + 0x5c, 0x0c, 0xe9, 0x3e, 0x44, 0x35, 0x0c, 0xdd, 0xe2, 0xff, 0xba, 0x47, 0xc9, 0x07, 0x7e, 0xf5, + 0x37, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xf7, 0x96, 0xdb, 0xdd, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// ExecutionServiceClient is the client API for ExecutionService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ExecutionServiceClient interface { + InitChain(ctx context.Context, in *InitChainRequest, opts ...grpc.CallOption) (*InitChainResponse, error) + GetTxs(ctx context.Context, in *GetTxsRequest, opts ...grpc.CallOption) (*GetTxsResponse, error) + ExecuteTxs(ctx context.Context, in *ExecuteTxsRequest, opts ...grpc.CallOption) (*ExecuteTxsResponse, error) + SetFinal(ctx context.Context, in *SetFinalRequest, opts ...grpc.CallOption) (*SetFinalResponse, error) +} + +type executionServiceClient struct { + cc grpc1.ClientConn +} + +func NewExecutionServiceClient(cc grpc1.ClientConn) ExecutionServiceClient { + return &executionServiceClient{cc} +} + +func (c *executionServiceClient) InitChain(ctx context.Context, in *InitChainRequest, opts ...grpc.CallOption) (*InitChainResponse, error) { + out := new(InitChainResponse) + err := c.cc.Invoke(ctx, "/execution.ExecutionService/InitChain", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *executionServiceClient) GetTxs(ctx context.Context, in *GetTxsRequest, opts ...grpc.CallOption) (*GetTxsResponse, error) { + out := new(GetTxsResponse) + err := c.cc.Invoke(ctx, "/execution.ExecutionService/GetTxs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *executionServiceClient) ExecuteTxs(ctx context.Context, in *ExecuteTxsRequest, opts ...grpc.CallOption) (*ExecuteTxsResponse, error) { + out := new(ExecuteTxsResponse) + err := c.cc.Invoke(ctx, "/execution.ExecutionService/ExecuteTxs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *executionServiceClient) SetFinal(ctx context.Context, in *SetFinalRequest, opts ...grpc.CallOption) (*SetFinalResponse, error) { + out := new(SetFinalResponse) + err := c.cc.Invoke(ctx, "/execution.ExecutionService/SetFinal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ExecutionServiceServer is the server API for ExecutionService service. +type ExecutionServiceServer interface { + InitChain(context.Context, *InitChainRequest) (*InitChainResponse, error) + GetTxs(context.Context, *GetTxsRequest) (*GetTxsResponse, error) + ExecuteTxs(context.Context, *ExecuteTxsRequest) (*ExecuteTxsResponse, error) + SetFinal(context.Context, *SetFinalRequest) (*SetFinalResponse, error) +} + +// UnimplementedExecutionServiceServer can be embedded to have forward compatible implementations. +type UnimplementedExecutionServiceServer struct { +} + +func (*UnimplementedExecutionServiceServer) InitChain(ctx context.Context, req *InitChainRequest) (*InitChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InitChain not implemented") +} +func (*UnimplementedExecutionServiceServer) GetTxs(ctx context.Context, req *GetTxsRequest) (*GetTxsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTxs not implemented") +} +func (*UnimplementedExecutionServiceServer) ExecuteTxs(ctx context.Context, req *ExecuteTxsRequest) (*ExecuteTxsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecuteTxs not implemented") +} +func (*UnimplementedExecutionServiceServer) SetFinal(ctx context.Context, req *SetFinalRequest) (*SetFinalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetFinal not implemented") +} + +func RegisterExecutionServiceServer(s grpc1.Server, srv ExecutionServiceServer) { + s.RegisterService(&_ExecutionService_serviceDesc, srv) +} + +func _ExecutionService_InitChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InitChainRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExecutionServiceServer).InitChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/execution.ExecutionService/InitChain", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExecutionServiceServer).InitChain(ctx, req.(*InitChainRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ExecutionService_GetTxs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTxsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExecutionServiceServer).GetTxs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/execution.ExecutionService/GetTxs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExecutionServiceServer).GetTxs(ctx, req.(*GetTxsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ExecutionService_ExecuteTxs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExecuteTxsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExecutionServiceServer).ExecuteTxs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/execution.ExecutionService/ExecuteTxs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExecutionServiceServer).ExecuteTxs(ctx, req.(*ExecuteTxsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ExecutionService_SetFinal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetFinalRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExecutionServiceServer).SetFinal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/execution.ExecutionService/SetFinal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExecutionServiceServer).SetFinal(ctx, req.(*SetFinalRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ExecutionService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "execution.ExecutionService", + HandlerType: (*ExecutionServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "InitChain", + Handler: _ExecutionService_InitChain_Handler, + }, + { + MethodName: "GetTxs", + Handler: _ExecutionService_GetTxs_Handler, + }, + { + MethodName: "ExecuteTxs", + Handler: _ExecutionService_ExecuteTxs_Handler, + }, + { + MethodName: "SetFinal", + Handler: _ExecutionService_SetFinal_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "execution/execution.proto", +} + +func (m *InitChainRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *InitChainRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InitChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x1a + } + if m.InitialHeight != 0 { + i = encodeVarintExecution(dAtA, i, uint64(m.InitialHeight)) + i-- + dAtA[i] = 0x10 + } + if m.GenesisTime != 0 { + i = encodeVarintExecution(dAtA, i, uint64(m.GenesisTime)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *InitChainResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *InitChainResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InitChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxBytes != 0 { + i = encodeVarintExecution(dAtA, i, uint64(m.MaxBytes)) + i-- + dAtA[i] = 0x10 + } + if len(m.StateRoot) > 0 { + i -= len(m.StateRoot) + copy(dAtA[i:], m.StateRoot) + i = encodeVarintExecution(dAtA, i, uint64(len(m.StateRoot))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetTxsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTxsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetTxsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *GetTxsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTxsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetTxsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Txs) > 0 { + for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Txs[iNdEx]) + copy(dAtA[i:], m.Txs[iNdEx]) + i = encodeVarintExecution(dAtA, i, uint64(len(m.Txs[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ExecuteTxsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ExecuteTxsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExecuteTxsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PrevStateRoot) > 0 { + i -= len(m.PrevStateRoot) + copy(dAtA[i:], m.PrevStateRoot) + i = encodeVarintExecution(dAtA, i, uint64(len(m.PrevStateRoot))) + i-- + dAtA[i] = 0x22 + } + if m.Timestamp != 0 { + i = encodeVarintExecution(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x18 + } + if m.BlockHeight != 0 { + i = encodeVarintExecution(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x10 + } + if len(m.Txs) > 0 { + for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Txs[iNdEx]) + copy(dAtA[i:], m.Txs[iNdEx]) + i = encodeVarintExecution(dAtA, i, uint64(len(m.Txs[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ExecuteTxsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ExecuteTxsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExecuteTxsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxBytes != 0 { + i = encodeVarintExecution(dAtA, i, uint64(m.MaxBytes)) + i-- + dAtA[i] = 0x10 + } + if len(m.UpdatedStateRoot) > 0 { + i -= len(m.UpdatedStateRoot) + copy(dAtA[i:], m.UpdatedStateRoot) + i = encodeVarintExecution(dAtA, i, uint64(len(m.UpdatedStateRoot))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SetFinalRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetFinalRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetFinalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlockHeight != 0 { + i = encodeVarintExecution(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SetFinalResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetFinalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetFinalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintExecution(dAtA []byte, offset int, v uint64) int { + offset -= sovExecution(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *InitChainRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GenesisTime != 0 { + n += 1 + sovExecution(uint64(m.GenesisTime)) + } + if m.InitialHeight != 0 { + n += 1 + sovExecution(uint64(m.InitialHeight)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + return n +} + +func (m *InitChainResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StateRoot) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + if m.MaxBytes != 0 { + n += 1 + sovExecution(uint64(m.MaxBytes)) + } + return n +} + +func (m *GetTxsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *GetTxsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Txs) > 0 { + for _, b := range m.Txs { + l = len(b) + n += 1 + l + sovExecution(uint64(l)) + } + } + return n +} + +func (m *ExecuteTxsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Txs) > 0 { + for _, b := range m.Txs { + l = len(b) + n += 1 + l + sovExecution(uint64(l)) + } + } + if m.BlockHeight != 0 { + n += 1 + sovExecution(uint64(m.BlockHeight)) + } + if m.Timestamp != 0 { + n += 1 + sovExecution(uint64(m.Timestamp)) + } + l = len(m.PrevStateRoot) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + return n +} + +func (m *ExecuteTxsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UpdatedStateRoot) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + if m.MaxBytes != 0 { + n += 1 + sovExecution(uint64(m.MaxBytes)) + } + return n +} + +func (m *SetFinalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockHeight != 0 { + n += 1 + sovExecution(uint64(m.BlockHeight)) + } + return n +} + +func (m *SetFinalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovExecution(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozExecution(x uint64) (n int) { + return sovExecution(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *InitChainRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: InitChainRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: InitChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisTime", wireType) + } + m.GenesisTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GenesisTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialHeight", wireType) + } + m.InitialHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InitialHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthExecution + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *InitChainResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: InitChainResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: InitChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthExecution + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...) + if m.StateRoot == nil { + m.StateRoot = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBytes", wireType) + } + m.MaxBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxBytes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTxsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTxsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTxsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTxsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTxsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTxsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Txs", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthExecution + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Txs = append(m.Txs, make([]byte, postIndex-iNdEx)) + copy(m.Txs[len(m.Txs)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ExecuteTxsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ExecuteTxsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExecuteTxsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Txs", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthExecution + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Txs = append(m.Txs, make([]byte, postIndex-iNdEx)) + copy(m.Txs[len(m.Txs)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevStateRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthExecution + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrevStateRoot = append(m.PrevStateRoot[:0], dAtA[iNdEx:postIndex]...) + if m.PrevStateRoot == nil { + m.PrevStateRoot = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ExecuteTxsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ExecuteTxsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExecuteTxsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatedStateRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthExecution + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UpdatedStateRoot = append(m.UpdatedStateRoot[:0], dAtA[iNdEx:postIndex]...) + if m.UpdatedStateRoot == nil { + m.UpdatedStateRoot = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBytes", wireType) + } + m.MaxBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxBytes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetFinalRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SetFinalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetFinalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetFinalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SetFinalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetFinalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipExecution(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExecution + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExecution + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExecution + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthExecution + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupExecution + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthExecution + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthExecution = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowExecution = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupExecution = fmt.Errorf("proto: unexpected end of group") +)