Skip to content

Commit

Permalink
Fix error from CalculateNonceAndVUB (#3134)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-khimov authored Feb 20, 2025
2 parents 301ccb8 + 0ddb375 commit d540de0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ Changelog for NeoFS Node
- `neofs_node_engine_list_objects_time_bucket` metric (#3120)
- The correct role parameter to invocation (#3127)
- nil pointer error for `storage sanity` command (#3151)
- Process designation event of the mainnet RoleManagement contract (#3134)

### Changed
- Number of cuncurrenly handled notifications from the chain was increased from 10 to 300 for IR (#3068)
- Write-cache size estimations (#3106)
- New network map support solving the limit of ~320 nodes per network
- Calculation of VUB for zero hash (#3134)

### Removed
- Drop creating new eacl tables with public keys (#3096)
Expand Down
13 changes: 8 additions & 5 deletions pkg/innerring/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,18 @@ func (s *Server) voteForFSChainValidator(validators keys.PublicKeys, trigger *ut
nonce uint32 = 1
vub uint32
vubP *uint32
hash util.Uint256
)

if trigger != nil {
nonce, vub, err = s.morphClient.CalculateNonceAndVUB(*trigger)
if err != nil {
return fmt.Errorf("could not calculate nonce and `validUntilBlock` values: %w", err)
}
vubP = &vub
hash = *trigger
}

nonce, vub, err = s.morphClient.CalculateNonceAndVUB(hash)
if err != nil {
return fmt.Errorf("could not calculate nonce and `validUntilBlock` values: %w", err)
}
vubP = &vub

s.contracts.alphabet.iterate(func(ind int, contract util.Uint160) {
_, err := s.morphClient.NotaryInvoke(contract, 0, nonce, vubP, voteMethod, epoch, validators)
Expand Down
11 changes: 9 additions & 2 deletions pkg/morph/client/notary.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (c *Client) UpdateNotaryList(notaries keys.PublicKeys, txHash util.Uint256)

nonce, vub, err := c.CalculateNonceAndVUB(txHash)
if err != nil {
return fmt.Errorf("could not calculate nonce and `valicUntilBlock` values: %w", err)
return fmt.Errorf("could not calculate nonce and `validUntilBlock` values: %w", err)
}

return c.notaryInvokeAsCommittee(
Expand All @@ -292,7 +292,7 @@ func (c *Client) UpdateNeoFSAlphabetList(alphas keys.PublicKeys, txHash util.Uin

nonce, vub, err := c.CalculateNonceAndVUB(txHash)
if err != nil {
return fmt.Errorf("could not calculate nonce and `valicUntilBlock` values: %w", err)
return fmt.Errorf("could not calculate nonce and `validUntilBlock` values: %w", err)
}

return c.notaryInvokeAsCommittee(
Expand Down Expand Up @@ -767,6 +767,13 @@ func (c *Client) CalculateNonceAndVUB(hash util.Uint256) (nonce uint32, vub uint

nonce = binary.LittleEndian.Uint32(hash.BytesLE())

if hash.Equals(util.Uint256{}) {
vub, err = c.notaryTxValidationLimit(conn)
if err != nil {
return 0, 0, fmt.Errorf("could not get vub validation limit: %w", err)
}
return nonce, vub, nil
}
height, err := c.getTransactionHeight(conn, hash)
if err != nil {
return 0, 0, fmt.Errorf("could not get transaction height: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/morph/event/rolemanagement/designate.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ func ParseDesignate(e *state.ContainedNotificationEvent) (event.Event, error) {

return Designate{
Role: noderoles.Role(bi.Int64()),
TxHash: e.Container,
TxHash: util.Uint256{},
}, nil
}

0 comments on commit d540de0

Please sign in to comment.