-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Execution API #9
base: main
Are you sure you want to change the base?
Changes from all commits
6028e95
52076f8
376e933
d255749
f2b482c
f38ab59
b7513b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
with-expecter: true | ||
packages: | ||
github.com/LastL2/execution: | ||
interfaces: | ||
Execute: | ||
config: | ||
dir: mocks | ||
outpkg: mocks |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really like simplified approach to proto generation, without docker, like in https://github.com/rollkit/go-da/blob/main/Makefile#L78 This helps with access rights to generated files, and reduces complexity in general. |
||
@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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: v1beta1 | ||
deps: | ||
- buf.build/cosmos/gogo-proto | ||
build: | ||
roots: | ||
- proto | ||
- third_party/proto | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please clean up. |
||
breaking: | ||
use: | ||
- FILE |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,41 @@ | ||||||
package execution | ||||||
|
||||||
import ( | ||||||
"time" | ||||||
|
||||||
"github.com/rollkit/rollkit/types" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We cannot depend on |
||||||
) | ||||||
|
||||||
// Execute defines a common interface for interacting with the execution client. | ||||||
type Execute interface { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||||||
// InitChain initializes the blockchain with genesis information. | ||||||
InitChain( | ||||||
genesisTime time.Time, | ||||||
initialHeight uint64, | ||||||
chainID string, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #10 and (original EPIC) we used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gupadhyaya what do you think about this? |
||||||
) ( | ||||||
stateRoot types.Hash, | ||||||
maxBytes uint64, | ||||||
err error, | ||||||
) | ||||||
|
||||||
// GetTxs retrieves all available transactions from the execution client's mempool. | ||||||
GetTxs() ([]types.Tx, error) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To clarify, I think |
||||||
|
||||||
// ExecuteTxs executes a set of transactions to produce a new block header. | ||||||
ExecuteTxs( | ||||||
txs []types.Tx, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
blockHeight uint64, | ||||||
timestamp time.Time, | ||||||
prevStateRoot types.Hash, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) ( | ||||||
updatedStateRoot types.Hash, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
maxBytes uint64, | ||||||
err error, | ||||||
) | ||||||
|
||||||
// SetFinal marks a block at the given height as final. | ||||||
SetFinal( | ||||||
blockHeight uint64, | ||||||
) error | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't have rollkit as dependency in go-execution, because rollkit will depend on go-execution, which makes circular dependency. |
||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mocks should be located in github.com/rollkit/go-execution/mocks