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

Get tx API fixes #37

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
module github.com/thetatoken/theta-eth-rpc-adaptor

require (
cloud.google.com/go/datastore v1.1.0 // indirect
cloud.google.com/go/pubsub v1.3.1 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/dgraph-io/badger v1.6.1 // indirect
github.com/ethereum/go-ethereum v1.9.23
github.com/go-kit/kit v0.9.0 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/pborman/uuid v1.2.0 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.5.0
github.com/spf13/viper v1.13.0
Expand All @@ -16,6 +24,7 @@ require (
github.com/thetatoken/theta v0.0.0
github.com/thetatoken/theta/common v0.0.0
github.com/ybbus/jsonrpc v1.1.1
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 // indirect
)

replace github.com/thetatoken/theta v0.0.0 => ../theta
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fd/go-nat v1.0.0 h1:DPyQ97sxA9ThrWYRPcWUz/z9TnpTIGRYODIQc/dy64M=
github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E=
github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
Expand Down Expand Up @@ -1026,8 +1025,6 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 h1:v6hYoSR9T5oet+pMXwUWkbiVqx/63mlHjefrHmxwfeY=
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
11 changes: 8 additions & 3 deletions integration/docker/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
FROM golang:1.11
# Cross-compilation issue on Apple Silicon
# https://github.com/mattn/go-sqlite3/issues/992#issuecomment-1002559704

FROM golang:1.18

VOLUME ["/go"]

WORKDIR /go/src/github.com/thetatoken/theta-eth-rpc-adaptor/

ENV GOPATH=/go

ENV CGO_ENABLED=1
RUN dpkg --add-architecture amd64 \
&& apt-get update \
&& apt-get install -y --no-install-recommends gcc-x86-64-linux-gnu g++-x86-64-linux-gnu libc6-dev-amd64-cross

ENV GO111MODULE=on
COPY . .

CMD ["/go/src/github.com/thetatoken/theta-eth-rpc-adaptor/integration/docker/build/start.sh"]

Expand Down
2 changes: 1 addition & 1 deletion integration/docker/build/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -x

GOBIN=/usr/local/go/bin/go

$GOBIN build -o ./build/linux/theta-eth-rpc-adaptor ./cmd/theta-eth-rpc-adaptor
CGO_ENABLED=1 GOARCH=amd64 CC=x86_64-linux-gnu-gcc CXX=g++-x86-64-linux-gnu $GOBIN build -o ./build/linux/theta-eth-rpc-adaptor ./cmd/theta-eth-rpc-adaptor

set +x

Expand Down
7 changes: 6 additions & 1 deletion rpc/ethrpc/eth_get_transaction_by_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ func (e *EthRPCService) GetTransactionByHash(ctx context.Context, hashStr string
logger.Warnf("eth_getTransactionByHash failed, err: %v", rpcErr)
}

parse := func(jsonBytes []byte) (interface{}, error) {
parse := func(jsonBytes []byte) (resultIntf interface{}, err error) {
err = fmt.Errorf("Failed to parse the transaction")
defer func() {
recover() // recover from parsing exception.
}()

trpcResult := trpc.GetTransactionResult{}
json.Unmarshal(jsonBytes, &trpcResult)
if (trpcResult.BlockHash == tcommon.Hash{}) {
Expand Down