diff --git a/app/cmd/cli/app.go b/app/cmd/cli/app.go index 628c0be24..a495e8d79 100644 --- a/app/cmd/cli/app.go +++ b/app/cmd/cli/app.go @@ -182,8 +182,6 @@ var createAATCmd = &cobra.Command{ Short: "Creates an application authentication token", Long: `Creates a signed Application Authentication Token. -WARNING: USE THIS METHOD AT YOUR OWN RISK. - This CLI is hard-coded to generate an AAT with spec version 0.0.1. The output is intended to be embedded into the Gateway for Relay servicing. @@ -223,14 +221,12 @@ Make sure to read doc/specs/application-auth-token.md to understand what's recom return } - // Generate the AAT aat, err := app.GenerateAAT(pubKeyHexEncoded, args[1], privKey) if err != nil { fmt.Println(err) return } - // Print out the AAT fmt.Println(string(aat)) }, } diff --git a/app/cmd/cli/gov.go b/app/cmd/cli/gov.go index 5d4eb51da..f92fae2f0 100644 --- a/app/cmd/cli/gov.go +++ b/app/cmd/cli/gov.go @@ -7,10 +7,11 @@ import ( "strconv" "strings" + "github.com/spf13/cobra" + "github.com/pokt-network/pocket-core/app" "github.com/pokt-network/pocket-core/types" govTypes "github.com/pokt-network/pocket-core/x/gov/types" - "github.com/spf13/cobra" ) func init() { @@ -120,6 +121,7 @@ Actions: [burn, transfer]`, fmt.Println(resp) }, } + var govChangeParam = &cobra.Command{ Use: "change_param ", Short: "Edit a param in the network", @@ -205,6 +207,7 @@ func dropTag(version string) string { } const FeatureUpgradeKey = "FEATURE" + const FeatureUpgradeHeight = int64(1) var govFeatureEnable = &cobra.Command{ diff --git a/app/cmd/cli/node.go b/app/cmd/cli/node.go index acb74c8bf..938d9461b 100644 --- a/app/cmd/cli/node.go +++ b/app/cmd/cli/node.go @@ -5,8 +5,9 @@ import ( "fmt" "strconv" - "github.com/pokt-network/pocket-core/app" "github.com/spf13/cobra" + + "github.com/pokt-network/pocket-core/app" ) func init() { diff --git a/app/cmd/cli/query.go b/app/cmd/cli/query.go index be11baee9..3daa26fb6 100644 --- a/app/cmd/cli/query.go +++ b/app/cmd/cli/query.go @@ -6,13 +6,13 @@ import ( "strconv" "strings" + "github.com/spf13/cobra" + + "github.com/pokt-network/pocket-core/app" "github.com/pokt-network/pocket-core/app/cmd/rpc" "github.com/pokt-network/pocket-core/types" types2 "github.com/pokt-network/pocket-core/x/apps/types" - - "github.com/pokt-network/pocket-core/app" nodeTypes "github.com/pokt-network/pocket-core/x/nodes/types" - "github.com/spf13/cobra" ) func init() { @@ -342,9 +342,13 @@ var queryAccount = &cobra.Command{ } var nodeStakingStatus string + var nodeJailedStatus string + var blockchain string + var nodePage int + var nodeLimit int func init() { @@ -490,6 +494,7 @@ var queryNodeParams = &cobra.Command{ } var appStakingStatus string + var appPage, appLimit int func init() { diff --git a/app/cmd/cli/root.go b/app/cmd/cli/root.go index b3bedcd09..3cb689a7f 100644 --- a/app/cmd/cli/root.go +++ b/app/cmd/cli/root.go @@ -8,9 +8,10 @@ import ( "syscall" "time" + "github.com/spf13/cobra" + "github.com/pokt-network/pocket-core/app" "github.com/pokt-network/pocket-core/app/cmd/rpc" - "github.com/spf13/cobra" ) var ( diff --git a/app/cmd/cli/stake.go b/app/cmd/cli/stake.go index 10355de40..3318a7811 100644 --- a/app/cmd/cli/stake.go +++ b/app/cmd/cli/stake.go @@ -8,9 +8,10 @@ import ( "strconv" "strings" + "github.com/spf13/cobra" + "github.com/pokt-network/pocket-core/app" "github.com/pokt-network/pocket-core/types" - "github.com/spf13/cobra" ) func init() { diff --git a/app/cmd/cli/util.go b/app/cmd/cli/util.go index a1f924390..28aa658f8 100644 --- a/app/cmd/cli/util.go +++ b/app/cmd/cli/util.go @@ -2,14 +2,15 @@ package cli import ( "fmt" - "github.com/pokt-network/pocket-core/x/pocketcore/types" "os" "strconv" - "github.com/pokt-network/pocket-core/app" "github.com/spf13/cobra" "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/state" + + "github.com/pokt-network/pocket-core/app" + "github.com/pokt-network/pocket-core/x/pocketcore/types" ) func init() { diff --git a/app/cmd/rpc/client.go b/app/cmd/rpc/client.go index 98e596fa6..b92e74cf3 100644 --- a/app/cmd/rpc/client.go +++ b/app/cmd/rpc/client.go @@ -66,7 +66,6 @@ func Relay(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { WriteJSONResponseWithCode(w, string(j), r.URL.Path, r.Host, 400) return } - // Handling the relay res, dispatch, err := app.PCA.HandleRelay(relay) if err != nil { response := RPCRelayErrorResponse{ diff --git a/app/config.go b/app/config.go index 6b20615e6..1129b3401 100644 --- a/app/config.go +++ b/app/config.go @@ -17,6 +17,22 @@ import ( kitlevel "github.com/go-kit/kit/log/level" "github.com/go-kit/kit/log/term" + "github.com/spf13/cobra" + config2 "github.com/tendermint/tendermint/config" + cryptoamino "github.com/tendermint/tendermint/crypto/encoding/amino" + "github.com/tendermint/tendermint/libs/cli/flags" + "github.com/tendermint/tendermint/libs/log" + cmn "github.com/tendermint/tendermint/libs/os" + "github.com/tendermint/tendermint/libs/rand" + "github.com/tendermint/tendermint/node" + "github.com/tendermint/tendermint/p2p" + "github.com/tendermint/tendermint/privval" + "github.com/tendermint/tendermint/rpc/client" + "github.com/tendermint/tendermint/rpc/client/http" + "github.com/tendermint/tendermint/rpc/client/local" + dbm "github.com/tendermint/tm-db" + "golang.org/x/crypto/ssh/terminal" + "github.com/pokt-network/pocket-core/baseapp" "github.com/pokt-network/pocket-core/codec" types2 "github.com/pokt-network/pocket-core/codec/types" @@ -33,21 +49,6 @@ import ( nodesTypes "github.com/pokt-network/pocket-core/x/nodes/types" pocket "github.com/pokt-network/pocket-core/x/pocketcore" "github.com/pokt-network/pocket-core/x/pocketcore/types" - "github.com/spf13/cobra" - config2 "github.com/tendermint/tendermint/config" - cryptoamino "github.com/tendermint/tendermint/crypto/encoding/amino" - "github.com/tendermint/tendermint/libs/cli/flags" - "github.com/tendermint/tendermint/libs/log" - cmn "github.com/tendermint/tendermint/libs/os" - "github.com/tendermint/tendermint/libs/rand" - "github.com/tendermint/tendermint/node" - "github.com/tendermint/tendermint/p2p" - "github.com/tendermint/tendermint/privval" - "github.com/tendermint/tendermint/rpc/client" - "github.com/tendermint/tendermint/rpc/client/http" - "github.com/tendermint/tendermint/rpc/client/local" - dbm "github.com/tendermint/tm-db" - "golang.org/x/crypto/ssh/terminal" ) var ( diff --git a/doc/specs/cli/apps.md b/doc/specs/cli/apps.md index 7a9d6bbee..9749f8704 100644 --- a/doc/specs/cli/apps.md +++ b/doc/specs/cli/apps.md @@ -61,8 +61,6 @@ Transaction submitted with hash: pocket apps create-aat ``` -**WARNING: USE THIS METHOD AT YOUR OWN RISK.** - This CLI is hard-coded to generate an AAT with spec version 0.0.1. The output is intended to be embedded into the Gateway for Relay servicing. diff --git a/x/pocketcore/types/proof.go b/x/pocketcore/types/proof.go index 88e0a63f9..3f0df954b 100644 --- a/x/pocketcore/types/proof.go +++ b/x/pocketcore/types/proof.go @@ -55,31 +55,26 @@ func (ps ProofIs) FromProofI() (res Proofs) { var _ Proof = RelayProof{} // ensure implements interface at compile time -// ValidateLocal validates the Relay Proof object, where the owner of the proof is the local node - +// ValidateLocal validates the Relay Proof object is aligned with `sessionBlockHeight` and `verifyAddr`. func (rp RelayProof) ValidateLocal( appSupportedBlockchains []string, - sessionNodeCount int, sessionBlockHeight int64, - verifyAddr sdk.Address, + expectedServicerAddr sdk.Address, ) sdk.Error { - // Basic validation of the relay proof err := rp.ValidateBasic() if err != nil { return err } - // Retrieve the servicer public key servicerPublicKey, er := crypto.NewPublicKey(rp.ServicerPubKey) if er != nil { return NewInvalidNodePubKeyError(ModuleName) } // validate the public key correctness - if !sdk.Address(servicerPublicKey.Address()).Equals(verifyAddr) { + if !sdk.Address(servicerPublicKey.Address()).Equals(expectedServicerAddr) { // the public key is not this nodes, so they would not get paid return NewInvalidNodePubKeyError(ModuleName) } - // ValidateLocal calling `rp.Validate` is important - err = rp.Validate(appSupportedBlockchains, sessionNodeCount, sessionBlockHeight) + err = rp.Validate(appSupportedBlockchains, sessionBlockHeight) if err != nil { return err } @@ -87,7 +82,7 @@ func (rp RelayProof) ValidateLocal( } // "Validate" - Validates the relay proof object -func (rp RelayProof) Validate(appSupportedBlockchains []string, sessionNodeCount int, sessionBlockHeight int64) sdk.Error { +func (rp RelayProof) Validate(appSupportedBlockchains []string, sessionBlockHeight int64) sdk.Error { // validate the session block height if rp.SessionBlockHeight != sessionBlockHeight { return NewInvalidBlockHeightError(ModuleName) @@ -129,7 +124,7 @@ func (rp RelayProof) ValidateBasic() sdk.Error { return NewInvalidEntropyError(ModuleName) } - // verify the AAT token + // validates the AAT in the relay proof if err := rp.Token.Validate(); err != nil { return NewInvalidTokenError(ModuleName, err) }