[#185] native: Issue session token on the previous epoch
All checks were successful
All checks were successful
Consider 2 nodes, A and B. Because of the race condition, A has epoch N, and B has (still) epoch N-1. Creating session token and putting object on the node A will set issuing epoch to N, thus failing validation on the node B. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
76fd5c9706
commit
220bdcb575
1 changed files with 9 additions and 4 deletions
|
@ -118,11 +118,16 @@ func (n *Native) Connect(endpoint, hexPrivateKey string, dialTimeout, streamTime
|
|||
tok.SetAuthKey(&key)
|
||||
tok.SetExp(exp)
|
||||
|
||||
res, err := cli.NetworkInfo(n.vu.Context(), client.PrmNetworkInfo{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
prevEpoch := res.Info().CurrentEpoch() - 1
|
||||
tok.SetNbf(prevEpoch)
|
||||
tok.SetIat(prevEpoch)
|
||||
|
||||
if prepareLocally && maxObjSize > 0 {
|
||||
res, err := cli.NetworkInfo(n.vu.Context(), client.PrmNetworkInfo{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if uint64(maxObjSize) > res.Info().MaxObjectSize() {
|
||||
return nil, fmt.Errorf("max object size must be not greater than %d bytes", res.Info().MaxObjectSize())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue