Skip to content
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

make: add gen commands #10106

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,6 @@ devtools:
$(GOBUILD) -o $(GOBIN)/mockgen go.uber.org/mock/mockgen
$(GOBUILD) -o $(GOBIN)/abigen ./cmd/abigen
$(GOBUILD) -o $(GOBIN)/codecgen github.com/ugorji/go/codec/codecgen
PATH=$(GOBIN):$(PATH) go generate ./common
# PATH=$(GOBIN):$(PATH) go generate ./core/types
PATH=$(GOBIN):$(PATH) cd ./cmd/rpcdaemon/graphql && go run github.com/99designs/gqlgen .
PATH=$(GOBIN):$(PATH) go generate ./consensus/aura/...
#PATH=$(GOBIN):$(PATH) go generate ./eth/ethconfig/...
@type "npm" 2> /dev/null || echo 'Please install node.js and npm'
@type "solc" 2> /dev/null || echo 'Please install solc'
@type "protoc" 2> /dev/null || echo 'Please install protoc'
Expand All @@ -223,6 +218,33 @@ mocks: mocks-clean
mocks-clean:
grep -r -l --exclude-dir=erigon-lib "^// Code generated by MockGen. DO NOT EDIT.$$" . | xargs rm -r

## solc: generate all solidity contracts
solc:
PATH="$(GOBIN):$(PATH)" go generate -run "solc" ./...

## abigen: generate abis using abigen
abigen:
$(GOBUILD) -o $(GOBIN)/abigen ./cmd/abigen
PATH="$(GOBIN):$(PATH)" go generate -run "abigen" ./...

## gencodec: generate marshalling code using gencodec
gencodec:
$(GOBUILD) -o $(GOBIN)/gencodec github.com/fjl/gencodec
PATH="$(GOBIN):$(PATH)" go generate -run "gencodec" ./...

## codecgen: generate encoder/decoder code using codecgen
codecgen:
$(GOBUILD) -o $(GOBIN)/codecgen github.com/ugorji/go/codec/codecgen
PATH="$(GOBIN):$(PATH)" go generate -run "codecgen" ./...

## graphql: generate graphql code
graphql:
PATH=$(GOBIN):$(PATH) cd ./cmd/rpcdaemon/graphql && go run github.com/99designs/gqlgen .

## gen: generate all auto-generated code in the codebase
gen: mocks solc abigen gencodec codecgen graphql
@cd erigon-lib && $(MAKE) gen

## bindings: generate test contracts and core contracts
bindings:
PATH=$(GOBIN):$(PATH) go generate ./tests/contracts/
Expand Down
5 changes: 2 additions & 3 deletions core/types/withdrawal.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ package types
import (
"bytes"
"fmt"
"github.com/ledgerwatch/erigon-lib/common/hexutil"
"io"

libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/hexutil"
"github.com/ledgerwatch/erigon-lib/types/clonable"

"github.com/ledgerwatch/erigon/rlp"
)

//go:generate go run github.com/fjl/gencodec -type Withdrawal -field-override withdrawalMarshaling -out gen_withdrawal_json.go
//go:generate gencodec -type Withdrawal -field-override withdrawalMarshaling -out gen_withdrawal_json.go

// Withdrawal represents a validator withdrawal from the consensus layer.
// See EIP-4895: Beacon chain push withdrawals as operations.
Expand Down
3 changes: 1 addition & 2 deletions eth/tracers/native/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ import (
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/hexutil"
"github.com/ledgerwatch/erigon-lib/common/hexutility"

"github.com/ledgerwatch/erigon/accounts/abi"
"github.com/ledgerwatch/erigon/core/vm"
"github.com/ledgerwatch/erigon/eth/tracers"
)

//go:generate go run github.com/fjl/gencodec -type callFrame -field-override callFrameMarshaling -out gen_callframe_json.go
//go:generate gencodec -type callFrame -field-override callFrameMarshaling -out gen_callframe_json.go

func init() {
register("callTracer", newCallTracer)
Expand Down
5 changes: 2 additions & 3 deletions eth/tracers/native/prestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@ package native
import (
"bytes"
"encoding/json"
"github.com/ledgerwatch/erigon-lib/common/hexutil"
"math/big"
"sync/atomic"

"github.com/holiman/uint256"

libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/hexutil"
"github.com/ledgerwatch/erigon-lib/common/hexutility"

"github.com/ledgerwatch/erigon/core/vm"
"github.com/ledgerwatch/erigon/crypto"
"github.com/ledgerwatch/erigon/eth/tracers"
)

//go:generate go run github.com/fjl/gencodec -type account -field-override accountMarshaling -out gen_account_json.go
//go:generate gencodec -type account -field-override accountMarshaling -out gen_account_json.go

func init() {
register("prestateTracer", newPrestateTracer)
Expand Down
Loading