Skip to content

Commit

Permalink
Merge branch 'dev' into trainingV2
Browse files Browse the repository at this point in the history
  • Loading branch information
semyon-dev authored Feb 10, 2025
2 parents ff6ba87 + 9559c23 commit f00a818
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ Precompiled binaries are published with each release,
download [from releases page](https://github.com/singnet/snet-daemon/releases) or use terminal:

```bash
curl -LJO https://github.com/singnet/snet-daemon/releases/download/v5.1.4/snetd-linux-amd64-v5.1.4
chmod +x snetd-linux-amd64-v5.1.4
curl -LJO https://github.com/singnet/snet-daemon/releases/download/v5.1.6/snetd-linux-amd64-v5.1.6
chmod +x snetd-linux-amd64-v5.1.6
```

#### Generate basic config file

For most users, a simple config is enough:

```bash
./snetd-linux-amd64-v5.1.4 init
./snetd-linux-amd64-v5.1.6 init
```

This command will generate a file `snetd.config.json` in which you will need to
Expand All @@ -49,19 +49,19 @@ change [some parameters](#main_properties).
#### Generate default full config file

```bash
./snetd-linux-amd64-v5.1.4 init-full
./snetd-linux-amd64-v5.1.6 init-full
```

#### Run Daemon

```bash
./snetd-linux-amd64-v5.1.4
./snetd-linux-amd64-v5.1.6
```

Specifying the path to the config using the '-c' argument:

```bash
./snetd-linux-amd64-v5.1.4 -c name_of_config.json
./snetd-linux-amd64-v5.1.6 -c name_of_config.json
```

## Configuration <a name="configuration"></a>
Expand Down Expand Up @@ -288,13 +288,13 @@ end [Example of MPE](https://github.com/singnet/wiki/tree/master/multiPartyEscro
At the moment treasurer server is a part of snet-daemon command line interface.

```bash
./snetd-linux-amd64-v5.1.4 claim --channel-id 0
./snetd-linux-amd64-v5.1.6 claim --channel-id 0
```

**Full list of commands, use --help to get more information:**

```bash
./snetd-linux-amd64-v5.1.4 --help
./snetd-linux-amd64-v5.1.6 --help

Usage:
snetd [flags]
Expand Down Expand Up @@ -363,13 +363,13 @@ part of the build. You need to pass the version as shown in the example below:
Bash:

```bash
./scripts/build linux amd64 v5.1.4
./scripts/build linux amd64 v5.1.6
```

Powershell:

```powershell
./scripts/build.ps1 linux amd64 v5.1.4
./scripts/build.ps1 linux amd64 v5.1.6
```

The final binaries will be in the `/build` folder.
Expand Down
14 changes: 13 additions & 1 deletion escrow/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (validator *FreeCallPaymentValidator) Validate(payment *FreeCallPayment) (e
return NewPaymentError(Unauthenticated, "payment signer is not valid %v , %v", signerAddress.Hex(), validator.freeCallSigner.Hex())
}
if newSignature {
if err := authutils.CheckIfTokenHasExpired(payment.AuthTokenExpiryBlockNumber); err != nil {
if err := validator.CheckIfBlockExpired(payment.AuthTokenExpiryBlockNumber); err != nil {
return err
}
}
Expand Down Expand Up @@ -138,6 +138,18 @@ func (validator *FreeCallPaymentValidator) compareWithLatestBlockNumber(blockNum
return nil
}

func (validator *FreeCallPaymentValidator) CheckIfBlockExpired(expiredBlock *big.Int) error {
currentBlockNumber, err := validator.currentBlock()
if err != nil {
return err
}

if expiredBlock.Cmp(currentBlockNumber) < 0 {
return fmt.Errorf("authentication failed as the Free Call Token passed has expired")
}
return nil
}

// deprecated
func (validator *FreeCallPaymentValidator) getSignerAddressForFreeCall(payment *FreeCallPayment) (signer *common.Address, err error) {

Expand Down

0 comments on commit f00a818

Please sign in to comment.