Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error from CalculateNonceAndVUB #3134

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
nonce uint32 = 1
vub uint32
vubP *uint32
hash util.Uint256

Check warning on line 126 in pkg/innerring/state.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/state.go#L126

Added line #L126 was not covered by tests
)

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
}

Check warning on line 131 in pkg/innerring/state.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/state.go#L130-L131

Added lines #L130 - L131 were not covered by tests

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

Check warning on line 135 in pkg/innerring/state.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/state.go#L133-L135

Added lines #L133 - L135 were not covered by tests
}
vubP = &vub

Check warning on line 137 in pkg/innerring/state.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/state.go#L137

Added line #L137 was not covered by tests

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 @@

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)

Check warning on line 271 in pkg/morph/client/notary.go

View check run for this annotation

Codecov / codecov/patch

pkg/morph/client/notary.go#L271

Added line #L271 was not covered by tests
}

return c.notaryInvokeAsCommittee(
Expand All @@ -292,7 +292,7 @@

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)

Check warning on line 295 in pkg/morph/client/notary.go

View check run for this annotation

Codecov / codecov/patch

pkg/morph/client/notary.go#L295

Added line #L295 was not covered by tests
}

return c.notaryInvokeAsCommittee(
Expand Down Expand Up @@ -767,6 +767,13 @@

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

Check warning on line 775 in pkg/morph/client/notary.go

View check run for this annotation

Codecov / codecov/patch

pkg/morph/client/notary.go#L770-L775

Added lines #L770 - L775 were not covered by tests
}
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{},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not excited about this one because I'd expect this "real->fake" translation at some other layer dealing with the event. But it should work.

}, nil
}
Loading