Skip to content

Commit

Permalink
Merge pull request #70 from Zondax/dev
Browse files Browse the repository at this point in the history
upgrade to 0.8.1
  • Loading branch information
jleni authored Oct 2, 2020
2 parents 3fa81b2 + 44ca294 commit 00a958b
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 69 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- checkout
- ffi_deps
- run: make build
- run: go test -race ./rosetta/services
- run: make test

checks:
docker:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- run:
name: "Run tests"
command: |
go test -race ./rosetta/tests
make test_integration
integration_rosetta_cli:
docker:
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ lint:
golangci-lint run -E gofmt -E gosec -E goconst -E gocritic
# golangci-lint run -E stylecheck -E gosec -E goconst -E godox -E gocritic

test:
go test
test: build
go test -race ./rosetta/services

test_integration: build
go test -race ./rosetta/tests

gitclean:
git clean -xfd
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ module github.com/zondax/rosetta-filecoin-proxy
go 1.14

require (
github.com/coinbase/rosetta-sdk-go v0.4.4
github.com/filecoin-project/go-address v0.0.3
github.com/filecoin-project/go-bitfield v0.2.0
github.com/filecoin-project/go-fil-markets v0.6.3
github.com/coinbase/rosetta-sdk-go v0.4.9
github.com/filecoin-project/go-address v0.0.4
github.com/filecoin-project/go-bitfield v0.2.1-0.20200920172649-837cbe6a1ed3
github.com/filecoin-project/go-fil-markets v0.7.0
github.com/filecoin-project/go-jsonrpc v0.1.2-0.20200822201400-474f4fdccc52
github.com/filecoin-project/go-multistore v0.0.3
github.com/filecoin-project/go-state-types v0.0.0-20200911004822-964d6c679cfc
github.com/filecoin-project/lotus v0.8.0
github.com/filecoin-project/specs-actors v0.9.11
github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab
github.com/filecoin-project/lotus v0.8.1
github.com/filecoin-project/specs-actors v0.9.12
github.com/ipfs/go-cid v0.0.7
github.com/ipfs/go-log v1.0.4
github.com/libp2p/go-libp2p-core v0.6.1
github.com/multiformats/go-multihash v0.0.14
github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6
github.com/stretchr/testify v1.6.1
github.com/zondax/rosetta-filecoin-lib v0.7.1
github.com/zondax/rosetta-filecoin-lib v0.8.1
gotest.tools v2.2.0+incompatible
)

Expand Down
87 changes: 48 additions & 39 deletions go.sum

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions rosetta/examples/create_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"net/http"
"strconv"
"time"
//filtypes "github.com/filecoin-project/lotus/chain/types"
)

const ServerURL = "http://localhost:8080"
Expand Down Expand Up @@ -94,7 +93,7 @@ func main() {
Metadata: mtx,
}

txBase64, err := r.ConstructPayment(pr)
txJSON, err := r.ConstructPayment(pr)
if err != nil {
panic(err)
}
Expand All @@ -104,15 +103,15 @@ func main() {
panic(err)
}

sig, err := r.SignTx(txBase64, sk)
signedTxJSON, err := r.SignTxJSON(txJSON, sk)
if err != nil {
panic(err)
}

fmt.Println(sig)
fmt.Println(signedTxJSON)
requestSubmit := &types.ConstructionSubmitRequest{
NetworkIdentifier: Network,
SignedTransaction: sig,
SignedTransaction: signedTxJSON,
}

respSubmit, err1, err2 := rosettaClient.ConstructionAPI.ConstructionSubmit(ctx, requestSubmit)
Expand All @@ -130,7 +129,7 @@ func main() {

fmt.Println(respSubmit.TransactionIdentifier.Hash)

hash, err := r.Hash(sig)
hash, err := r.Hash(signedTxJSON)
if err != nil {
panic(err)
}
Expand Down
16 changes: 12 additions & 4 deletions rosetta/services/mocks/fullnode_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ type FullNodeMock struct {
mock.Mock
}

func (f *FullNodeMock) SyncValidateTipset(ctx context.Context, tsk filTypes.TipSetKey) (bool, error) {
panic("implement me")
}

func (f *FullNodeMock) WalletValidateAddress(ctx context.Context, s string) (address.Address, error) {
panic("implement me")
}

func (f *FullNodeMock) ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.StorageAsk, error) {
panic("implement me")
}

func (f *FullNodeMock) StateMinerSectors(ctx context.Context, a address.Address, field *bitfield.BitField, key filTypes.TipSetKey) ([]*minerBuiltin.SectorOnChainInfo, error) {
panic("implement me")
}
Expand Down Expand Up @@ -547,10 +559,6 @@ func (f *FullNodeMock) ClientRetrieve(ctx context.Context, order api.RetrievalOr
panic("implement me")
}

func (f *FullNodeMock) ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error) {
panic("implement me")
}

func (f *FullNodeMock) ClientCalcCommP(ctx context.Context, inpath string) (*api.CommPRet, error) {
panic("implement me")
}
Expand Down
16 changes: 8 additions & 8 deletions rosetta/tests/rosetta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func TestSendTransaction(t *testing.T) {
Metadata: mtx,
}

txBase64, err := r.ConstructPayment(pr)
txJSON, err := r.ConstructPayment(pr)
if err != nil {
t.Fatal(err)
}
Expand All @@ -265,14 +265,14 @@ func TestSendTransaction(t *testing.T) {
t.Fatal(err)
}

sig, err := r.SignTx(txBase64, sk)
signedTxJSON, err := r.SignTxJSON(txJSON, sk)
if err != nil {
t.Fatal(err)
}

requestSubmit := &types.ConstructionSubmitRequest{
NetworkIdentifier: NetworkID,
SignedTransaction: sig,
SignedTransaction: signedTxJSON,
}

respSubmit, err1, err2 := rosettaClient.ConstructionAPI.ConstructionSubmit(ctx, requestSubmit)
Expand All @@ -288,7 +288,7 @@ func TestSendTransaction(t *testing.T) {
t.Fatal("Panicking")
}

hash, err := r.Hash(sig)
hash, err := r.Hash(signedTxJSON)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -349,7 +349,7 @@ func TestSendTransaction(t *testing.T) {
Metadata: mtx,
}

txBase64, err = r.ConstructPayment(pr)
txJSON, err = r.ConstructPayment(pr)
if err != nil {
t.Fatal(err)
}
Expand All @@ -359,14 +359,14 @@ func TestSendTransaction(t *testing.T) {
t.Fatal(err)
}

sig, err = r.SignTx(txBase64, sk)
signedTxJSON, err = r.SignTxJSON(txJSON, sk)
if err != nil {
t.Fatal(err)
}

requestSubmit = &types.ConstructionSubmitRequest{
NetworkIdentifier: NetworkID,
SignedTransaction: sig,
SignedTransaction: signedTxJSON,
}

respSubmit, err1, err2 = rosettaClient.ConstructionAPI.ConstructionSubmit(ctx, requestSubmit)
Expand All @@ -382,7 +382,7 @@ func TestSendTransaction(t *testing.T) {
t.Fatal("Panicking")
}

hash, err = r.Hash(sig)
hash, err = r.Hash(signedTxJSON)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 00a958b

Please sign in to comment.