native: Issue session token on the previous epoch #185

Merged
fyrchik merged 1 commit from fyrchik/xk6-frostfs:fix-native-epoch into master 2024-12-19 12:37:24 +00:00

View file

@ -118,11 +118,16 @@ func (n *Native) Connect(endpoint, hexPrivateKey string, dialTimeout, streamTime
tok.SetAuthKey(&key) tok.SetAuthKey(&key)
tok.SetExp(exp) tok.SetExp(exp)
if prepareLocally && maxObjSize > 0 {
res, err := cli.NetworkInfo(n.vu.Context(), client.PrmNetworkInfo{}) res, err := cli.NetworkInfo(n.vu.Context(), client.PrmNetworkInfo{})
if err != nil { if err != nil {
return nil, err return nil, err
} }
prevEpoch := res.Info().CurrentEpoch() - 1
tok.SetNbf(prevEpoch)
tok.SetIat(prevEpoch)
if prepareLocally && maxObjSize > 0 {
if uint64(maxObjSize) > res.Info().MaxObjectSize() { if uint64(maxObjSize) > res.Info().MaxObjectSize() {
return nil, fmt.Errorf("max object size must be not greater than %d bytes", res.Info().MaxObjectSize()) return nil, fmt.Errorf("max object size must be not greater than %d bytes", res.Info().MaxObjectSize())
} }