Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
updating deal types to legacy deals
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed May 8, 2024
1 parent d4046de commit 7449a16
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 28 deletions.
12 changes: 7 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/cosmos/cosmos-sdk v0.45.17
github.com/cosmos/go-bip39 v1.0.0
github.com/huin/goupnp v1.3.0
github.com/jackalLabs/canine-chain/v3 v3.0.0
github.com/jackalLabs/canine-chain/v3 v3.2.2
github.com/julienschmidt/httprouter v1.3.0
github.com/rs/cors v1.11.0
github.com/rs/zerolog v1.32.0
Expand All @@ -31,7 +31,7 @@ require (
github.com/99designs/keyring v1.2.1 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/CosmWasm/wasmd v0.32.0 // indirect
github.com/CosmWasm/wasmvm v1.2.3 // indirect
github.com/CosmWasm/wasmvm v1.2.6 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
Expand All @@ -57,7 +57,7 @@ require (
github.com/cosmos/iavl v0.19.5 // indirect
github.com/cosmos/ibc-go/v4 v4.6.0 // indirect
github.com/cosmos/interchain-accounts v0.2.6 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down Expand Up @@ -148,8 +148,8 @@ require (
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tendermint/tm-db v0.6.7 // indirect
github.com/tidwall/btree v1.5.0 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
Expand Down Expand Up @@ -183,6 +183,8 @@ replace (
// use cosmos-flavored protobufs
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

//github.com/jackalLabs/canine-chain/v3 => ../canine-chain

github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.27

github.com/wealdtech/go-merkletree => github.com/TheMarstonConnell/go-merkletree v0.0.0-20230328183338-b5d590ab1aaf
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMd
github.com/CloudyKit/jet/v6 v6.1.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4=
github.com/CosmWasm/wasmd v0.32.0 h1:EEwI29DBP/PmOKi1B/TCcukwkRNzwGRruKxD54gXjUE=
github.com/CosmWasm/wasmd v0.32.0/go.mod h1:CVq9KVQCXyYMaF7mVKIKhXYvc26rCeFid+Zv7hAtFqc=
github.com/CosmWasm/wasmvm v1.2.3 h1:OKYlobwmVGbl0eSn0mXoAAjE5hIuXnQCLPjbNd91sVY=
github.com/CosmWasm/wasmvm v1.2.3/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc=
github.com/CosmWasm/wasmvm v1.2.6 h1:QmOaiJUyeh8+pPCjJBTgWrbi/hCzCuWewduDO85Pcpc=
github.com/CosmWasm/wasmvm v1.2.6/go.mod h1:KO0zfQgCsQ6urWL1MYLlGqRgr7R4an6jo+LWRZjfD4c=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
Expand Down Expand Up @@ -287,8 +287,8 @@ github.com/cosmos/interchain-accounts v0.2.6 h1:TV2M2g1/Rb9MCNw1YePdBKE0rcEczNj1
github.com/cosmos/interchain-accounts v0.2.6/go.mod h1:lUzWNzCiCtIEYZefac5+YgEBz2aR39nMS374jIv1c7o=
github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA=
github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA=
github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI=
github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw=
github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
Expand Down Expand Up @@ -712,8 +712,8 @@ github.com/iris-contrib/jade v1.1.4/go.mod h1:EDqR+ur9piDl6DUgs6qRrlfzmlx/D5Uybo
github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g=
github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw=
github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA=
github.com/jackalLabs/canine-chain/v3 v3.0.0 h1:HiVexMVmvDmEmu+aZU908JeOJpAGRF5OcB8Hyfzo+iM=
github.com/jackalLabs/canine-chain/v3 v3.0.0/go.mod h1:9q17bBVcNA69GxPPUePCnZDg0RZecjJ7ef9vZGq7ogU=
github.com/jackalLabs/canine-chain/v3 v3.2.2 h1:MKEEApPSIW+YdvYjF0banDTljo50y9ezu1Ug+HLKVl4=
github.com/jackalLabs/canine-chain/v3 v3.2.2/go.mod h1:SU3K040CGmeXqyT52bf1k90v5dKMzY1zgJlEAg7f8mk=
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
Expand Down Expand Up @@ -1279,10 +1279,10 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo=
github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c=
github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320=
github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U=
github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw=
github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
Expand Down
2 changes: 1 addition & 1 deletion jprov/api/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type FidResponse struct {
}

type DealsResponse struct {
Deals []storagetypes.ActiveDeals `json:"deals"`
Deals []storagetypes.LegacyActiveDeals `json:"deals"`
}

type StraysResponse struct {
Expand Down
2 changes: 1 addition & 1 deletion jprov/server/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
storageTypes "github.com/jackalLabs/canine-chain/v3/x/storage/types"
)

func verifyAttest(deal storageTypes.ActiveDeals, attest types.AttestRequest) (verified bool, err error) {
func verifyAttest(deal storageTypes.LegacyActiveDeals, attest types.AttestRequest) (verified bool, err error) {
merkle := deal.Merkle
block := deal.Blocktoprove
blockNum, err := strconv.ParseInt(block, 10, 64)
Expand Down
2 changes: 1 addition & 1 deletion jprov/server/proofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (f *FileServer) ContractState(cid string) string {
return f.QueryContractState(cid)
}

func (f *FileServer) Prove(deal storageTypes.ActiveDeals) error {
func (f *FileServer) Prove(deal storageTypes.LegacyActiveDeals) error {
dex, ok := sdk.NewIntFromString(deal.Blocktoprove)
f.logger.Debug(fmt.Sprintf("BlockToProve: %s", deal.Blocktoprove))
if !ok {
Expand Down
14 changes: 7 additions & 7 deletions jprov/server/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ func (f *FileServer) QueryContractState(cid string) string {
return notVerified
}

func (f *FileServer) QueryAllActiveDeals() ([]storageTypes.ActiveDeals, error) {
func (f *FileServer) QueryAllActiveDeals() ([]storageTypes.LegacyActiveDeals, error) {
req := storageTypes.QueryAllActiveDealsRequest{
Pagination: &query.PageRequest{CountTotal: true},
}

activeDeals := make([]storageTypes.ActiveDeals, 0)
activeDeals := make([]storageTypes.LegacyActiveDeals, 0)

resp, err := f.queryClient.ActiveDealsAll(f.cmd.Context(), &req)
if err != nil {
Expand All @@ -73,12 +73,12 @@ func (f *FileServer) QueryAllActiveDeals() ([]storageTypes.ActiveDeals, error) {
return activeDeals, nil
}

func (f *FileServer) QueryOnlyMyActiveDeals() ([]storageTypes.ActiveDeals, error) {
func (f *FileServer) QueryOnlyMyActiveDeals() ([]storageTypes.LegacyActiveDeals, error) {
req := storageTypes.QueryAllActiveDealsRequest{
Pagination: &query.PageRequest{CountTotal: true},
}

activeDeals := make([]storageTypes.ActiveDeals, 0)
activeDeals := make([]storageTypes.LegacyActiveDeals, 0)

resp, err := f.queryClient.ActiveDealsAll(f.cmd.Context(), &req)
if err != nil {
Expand Down Expand Up @@ -112,12 +112,12 @@ func (f *FileServer) QueryOnlyMyActiveDeals() ([]storageTypes.ActiveDeals, error
return activeDeals, nil
}

func filterMyActiveDeals(activeDeals []storageTypes.ActiveDeals, provider string) []storageTypes.ActiveDeals {
func filterMyActiveDeals(activeDeals []storageTypes.LegacyActiveDeals, provider string) []storageTypes.LegacyActiveDeals {
if activeDeals == nil {
return nil
}

res := make([]storageTypes.ActiveDeals, 0)
res := make([]storageTypes.LegacyActiveDeals, 0)

for _, a := range activeDeals {
if a.Provider == provider {
Expand All @@ -127,7 +127,7 @@ func filterMyActiveDeals(activeDeals []storageTypes.ActiveDeals, provider string
return res
}

func (f *FileServer) QueryMyActiveDeals() ([]storageTypes.ActiveDeals, error) {
func (f *FileServer) QueryMyActiveDeals() ([]storageTypes.LegacyActiveDeals, error) {
activeDeals, err := f.QueryAllActiveDeals()
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions jprov/testutils/testFile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"io"

storagetypes "github.com/jackalLabs/canine-chain/v3/x/storage/types"
storageTypes "github.com/jackalLabs/canine-chain/v3/x/storage/types"

merkletree "github.com/wealdtech/go-merkletree"
"github.com/wealdtech/go-merkletree/sha3"
Expand Down Expand Up @@ -52,6 +52,6 @@ func (m *MerkleFile) GetJsonProof() []byte {
return proof
}

func (m *MerkleFile) GenerateActiveDeal() storagetypes.ActiveDeals {
return storagetypes.ActiveDeals{Blocktoprove: "0", Merkle: hex.EncodeToString(m.tree.Root())}
func (m *MerkleFile) GenerateActiveDeal() storageTypes.LegacyActiveDeals {
return storageTypes.LegacyActiveDeals{Blocktoprove: "0", Merkle: hex.EncodeToString(m.tree.Root())}
}

0 comments on commit 7449a16

Please sign in to comment.