Skip to content

Commit

Permalink
Reply to PR review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Mar 7, 2024
1 parent c5965fe commit 0054870
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 47 deletions.
14 changes: 6 additions & 8 deletions app/cmd/cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,14 @@ var createAATCmd = &cobra.Command{
Use: "create-aat <appAddr> <clientPubKey>",
Short: "Creates an application authentication token",
Long: `Creates a signed Application Authentication Token.
Creates a signed AAT (= Application Authentication Token) where the version is
hardcoded as "0.0.1" that is the only version supported by the protocol.
This CLI is hard-coded to generate an AAT with spec version 0.0.1.
This command prompts you to input the <appAddr> account passphrase.
When you send a relay request with AAT, <appAddr> needs to be a staked
application.
The output is intended to be embedded into the Gateway for Relay servicing.
Upon AAT generation, the user will be prompted for the <appAddr> account passphrase.
<appAddr> is associated with the application
Make sure to read doc/specs/application-auth-token.md to understand what's recommended during AAT configuration.`,
Please read doc/specs/application-auth-token.md for additional details.`,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
app.InitConfig(datadir, tmNode, persistentPeers, seeds, remoteCLIURL)
Expand Down
2 changes: 1 addition & 1 deletion app/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
pocketKeeper "github.com/pokt-network/pocket-core/x/pocketcore/keeper"
)

// GenerateAAT generates an AAT to be used for relay servicing.
// GenerateAAT generates an AAT to be used for relay request authentication.
// - appPubKey is the public key of the application that's paying for on-chain service.
// - clientPubKey (a.k.a gatewayPubKey) is the public key of the Gateway that's facilitating relays on behalf of the app.
// - appPubKey and clientPubKey may or may not be the same.
Expand Down
4 changes: 2 additions & 2 deletions doc/guides/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pocket accounts set-validator <address>
{% hint style="info" %} Check with `pocket accounts get-validator`
{% endhint %}

### Set [Relay Chains](https://docs.pokt.network/supported-blockchains/)
### Set [Relay Chains](https://docs.pokt.network/reference/supported-chains)

{% tabs %} {% tab title="Command" %}

Expand Down Expand Up @@ -468,7 +468,7 @@ Use pocket core flags --mainnet or --testnet to automatically write
Use the CLI or Manually Edit: `$HOME/.pocket/config/chains.json`

{% hint style="info" %} Relay Chain ID's and docs can be
found [here](https://docs.pokt.network/supported-blockchains/). {% endhint %}
found [here](https://docs.pokt.network/reference/supported-chains). {% endhint %}

These are external blockchain nodes such as ethereum, polygon and harmony. You will need to set these up by following their respective documentation. Once they are synced, you can enter the url and credentials into the following file.

Expand Down
29 changes: 15 additions & 14 deletions doc/specs/application-auth-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: >-
Version 0.0.1
The Pocket Network protocol contemplates the use of Application Auth Tokens (AATs)
The Pocket Network protocol contemplates the use of Application Authentication Tokens (AATs)
to allow Gateways (off-chain) access Service Nodes (a.k.a Suppliers) on behalf
of the Application.
---
Expand All @@ -26,8 +26,8 @@ staked `Application` to a `Client` by passing an AAT which includes their the
- [clientPublicKey](#clientpublickey)
- [ECDSA ed25519 Signature Scheme](#ecdsa-ed25519-signature-scheme)
- [AAT Generation](#aat-generation)
- [1. Application === Client (Gateway)](#1-application--client-gateway)
- [2. Application !== Gateway (Client)](#2-application--gateway-client)
- [1. Application !== Client (Gateway)](#1-application--client-gateway)
- [2. Application === Client (Gateway)](#2-application--client-gateway)
- [AAT Signature Generation](#aat-signature-generation)
- [Relay Generation \& Signing using AAT](#relay-generation--signing-using-aat)

Expand Down Expand Up @@ -76,43 +76,43 @@ When generating a new AAT, the owner of the `Application` private key can choose
which `Client` public key is used to sign Relays. More explicitly, this can be
decomposed into two options:

1. **Sovereign Application** - Use the same public key for signing the AAT and the relay requests
2. **Gateway** - Use a different public key for signing the AAT and the relay requests
1. **Application Key != Client Key ** - Recommended for all Gateways.
2. **Application Key == Client Key** - Recommended for independent Applications that are not Gateways.

### 1. Application === Client (Gateway)
### 1. Application !== Client (Gateway)

```mermaid
flowchart TB
App([AppPrivKey])
CG([ClientPrivateKey/ \n GatePrivateKey])
subgraph AAT Generation
direction TB
AATU["AAT (unsigned)"]
AAT["AAT"]
App -- AppPublicKey --> AATU
App -- ClientPublicKey --> AATU
CG -- ClientPublicKey --> AATU
AATU -- hash --> AATUB[AAT Bytes]
AATUB -- Sign with AppPrivKey --> sig[Application Signature]
AATU -- AAT Structure --> AAT
sig -- Signature --> AAT
end
```

### 2. Application !== Gateway (Client)
### 2. Application === Client (Gateway)

```mermaid
flowchart TB
App([AppPrivKey])
CG([ClientPrivateKey/ \n GatePrivateKey])
subgraph AAT Generation
direction TB
AATU["AAT (unsigned)"]
AAT["AAT"]
App -- AppPublicKey --> AATU
CG -- ClientPublicKey --> AATU
App -- ClientPublicKey --> AATU
AATU -- hash --> AATUB[AAT Bytes]
AATUB -- Sign with AppPrivKey --> sig[Application Signature]
AATU -- AAT Structure --> AAT
Expand Down Expand Up @@ -148,10 +148,11 @@ This section can be summarized by two key points:
- AAT includes client public key, signed by application private key
- Relay request includes an AAT, signed by client private key

The `Client` is needed to sign the relays while the `Application` is the one that
needs to stake on-chain to get access to Pocket Network's services. Recall that
when an `Application` generates an `AAT`, it can either use its own public key or
another public key (i.e. usually a Gateway's public key) to sign the `AAT`.
The `Client`, an application to send relays, needs to sign every relay request,
while `Application` needs to be staked once with tokens on-chain to get access to
Pocket Network's services. In every session, the maximum number of relays for an
app is proportional to the tokens to be staked with the app. To make more relays,
you need to stake more tokens.

```mermaid
flowchart TB
Expand Down
4 changes: 2 additions & 2 deletions doc/specs/cli/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Arguments:

- `<fromAddr>`: Target Address to stake.
- `<amount>`: The amount of uPOKT to stake. Must be higher than the current value of the `ApplicationStakeMinimum`
parameter, found [here](https://docs.pokt.network/learn/protocol-parameters/#applicationstakeminimum).
parameter.
- `<relayChainIDs>`: A comma separated list of RelayChain Network Identifiers. Find the RelayChain Network
Identifiers [here](https://docs.pokt.network/supported-blockchains/).
Identifiers [here](https://docs.pokt.network/reference/supported-chains).
- `<chainID>`: The Pocket chain identifier; "mainnet" or "testnet".
- `<fee>`: An amount of uPOKT for the network.

Expand Down
6 changes: 3 additions & 3 deletions doc/specs/cli/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Arguments:
- `<amount>`: The amount of uPOKT to stake. Must be higher than the current value of the `StakeMinimum` parameter,
found [here](https://docs.pokt.network/learn/protocol-parameters/#stakeminimum).
- `<relayChainIDs>`: A comma separated list of RelayChain Network Identifiers. Find the RelayChain Network
Identifiers [here](https://docs.pokt.network/supported-blockchains/).
Identifiers [here](https://docs.pokt.network/reference/supported-chains).
- `<serviceURI>`: The Service URI Applications will use to communicate with Nodes for Relays.
- `<networkID>`: The Pocket chain identifier; "mainnet" or "testnet".
- `<fee>`: An amount of uPOKT for the network.
Expand All @@ -63,7 +63,7 @@ Transaction submitted with hash: <Transaction Hash>
pocket nodes stake non-custodial <operatorPublicKey> <outputAddress> <amount> <RelayChainIDs> <serviceURI> <networkID> <fee> <isBefore8.0>
```

Stakes a non-custodial node in the network, making it available for service. The signer may be the operator or the output address. The signer must specify the passphrase of either the output or operator address when prompted for the `<fromAddr>` account passphrase. This will determine where the staked funds are taken from.
Stakes a non-custodial node in the network, making it available for service. The signer may be the operator or the output address. The signer must specify the passphrase of either the output or operator address when prompted for the `<fromAddr>` account passphrase. This will determine where the staked funds are taken from.

if the node is already staked, this transaction acts as an _update_ transaction. A node can update `<relayChainIDs>`
, `<serviceURI>`, and increase the stake `<amount>` with this transaction. If the node is currently staked at `X` and
Expand All @@ -77,7 +77,7 @@ Arguments:
- `<amount>`: The amount of uPOKT to stake. Must be higher than the current value of the `StakeMinimum` parameter,
found [here](https://docs.pokt.network/learn/protocol-parameters/#stakeminimum).
- `<relayChainIDs>`: A comma separated list of RelayChain Network Identifiers. Find the RelayChain Network
Identifiers [here](https://docs.pokt.network/supported-blockchains/).
Identifiers [here](https://docs.pokt.network/reference/supported-chains).
- `<serviceURI>`: The Service URI Applications will use to communicate with Nodes for Relays.
- `<networkID>`: The Pocket chain identifier; "mainnet" or "testnet".
- `<fee>`: An amount of uPOKT for the network.
Expand Down
19 changes: 9 additions & 10 deletions doc/specs/cli/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pocket util generate-chains
```

Generate the chains.json file for RelayChain Network Identifiers. Find the RelayChain Network
Identifiers [here](https://docs.pokt.network/supported-blockchains/).
Identifiers [here](https://docs.pokt.network/reference/supported-chains).

Example output:

Expand All @@ -35,7 +35,7 @@ pocket util delete-chains
```

Delete the chains.json file for RelayChain Network Identifiers. Find the RelayChain Network
Identifiers [here](https://docs.pokt.network/supported-blockchains/).
Identifiers [here](https://docs.pokt.network/reference/supported-chains).

Example Output:

Expand All @@ -53,11 +53,11 @@ Rolls back the blockchain, the state, and app to a previous height

Arguments:

* `<height>`: the height you want to rollback to.
- `<height>`: the height you want to rollback to.

Flags

* `blocks`: rollback block store and state
- `blocks`: rollback block store and state

## Decode Transaction

Expand All @@ -69,8 +69,8 @@ Decodes a given transaction encoded in Amino/Proto base64 bytes

Arguments:

* `<tx>`: The transaction amino encoded bytes.
* `<legacyCodec>`: Enable/Disable amino encoding for transaction.
- `<tx>`: The transaction amino encoded bytes.
- `<legacyCodec>`: Enable/Disable amino encoding for transaction.

Example output:

Expand All @@ -95,7 +95,7 @@ Generate completion script for the specified shell

Arguments:

* `<shell>`: the shell you currently use. Supported options: **bash / zsh / fish / powershell**
- `<shell>`: the shell you currently use. Supported options: **bash / zsh / fish / powershell**

## Convert Evidence to Proto from Amino

Expand Down Expand Up @@ -303,8 +303,8 @@ In the event of a network reset, this will export a genesis file based on the pr

Arguments:

* `<height>`: the height from which to generate genesis.json
* `<newChainID>`: the chainID to use for exporting.
- `<height>`: the height from which to generate genesis.json
- `<newChainID>`: the chainID to use for exporting.

Example Output:

Expand Down Expand Up @@ -333,4 +333,3 @@ Example Output:
}
}
```

2 changes: 1 addition & 1 deletion x/pocketcore/keeper/aat.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
pc "github.com/pokt-network/pocket-core/x/pocketcore/types"
)

// GenerateAAT generates an AAT to be used for relay servicing.
// GenerateAAT generates an AAT to be used for relay request authentication.
// - appPubKey is the public key of the application that's paying for on-chain service.
// - clientPubKey (a.k.a gatewayPubKey) is the public key of the Gateway that's facilitating relays on behalf of the app.
// - appPubKey and clientPubKey may or may not be the same.
Expand Down
5 changes: 1 addition & 4 deletions x/pocketcore/keeper/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ import (
pc "github.com/pokt-network/pocket-core/x/pocketcore/types"
)

// This is how servicers (a.k.a suppliers a.k.a as nodes a.k.a node runners) send proofs to the network.
// Nothing actionable (requests have already been signed by this point), but just FYI.

// auto sends a proof transaction for the claim
// SendProofTx auto sends a proof transaction for the claim
func (k Keeper) SendProofTx(ctx sdk.Ctx, n client.Client, node *pc.PocketNode, proofTx func(cliCtx util.CLIContext, txBuilder auth.TxBuilder, merkleProof pc.MerkleProof, leafNode pc.Proof, evidenceType pc.EvidenceType) (*sdk.TxResponse, error)) {
addr := node.GetAddress()
// get all mature (waiting period has passed) claims for your address
Expand Down
4 changes: 2 additions & 2 deletions x/pocketcore/types/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ func (rp RelayProof) ValidateBasic() sdk.Error {
return NewInvalidTokenError(ModuleName, err)
}

// Retrieving the client public key (aka the gateway public key), which
// may or may not be the same as the application public key depending on
// Retrieving the client public key
// NB: This is sometimes referred to as the gateway public key.
// the inputs to when the AAT was generated.
clientPubKey := rp.Token.ClientPublicKey

Expand Down

0 comments on commit 0054870

Please sign in to comment.