Skip to content

Conversation

@afck
Copy link
Contributor

@afck afck commented Oct 14, 2025

Motivation

With the exception of a GraphQL query, the chain state view should only be accessed by the corresponding chain worker. GraphQL is why the worker can return a shared chain state view behind a lock, but we are using that in many other places, too. After #4769, this is even more dangerous, as an actor could be dropped and restarted while shared views are still being used.

Proposal

Replace several chain_state_view() calls with chain info or new chain worker requests.

Also, extend a comment. (See #4793 (comment).)

Test Plan

CI

Release Plan

  • These changes should be backported to testnet_conway, then
    • be released in a new SDK.

Links

@afck afck requested review from bart-linera, deuszx and ma2bd October 14, 2025 11:30
Copy link
Contributor

@bart-linera bart-linera left a comment

Choose a reason for hiding this comment

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

Nice one 👍

Copy link
Contributor

@deuszx deuszx left a comment

Choose a reason for hiding this comment

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

Any way we can make sure no one misues this in the future? Maybe limiting the visibility of the field/API? Or moving it somewhere and hide behind a method.

@afck
Copy link
Contributor Author

afck commented Oct 14, 2025

Currently fn chain_state_view is in linera-core, but used in linera-service. Not sure what's the best way to avoid this in the future.

Merged via the queue into linera-io:main with commit 5a7ab8a Oct 14, 2025
31 checks passed
@afck afck deleted the shared-chain branch October 14, 2025 12:38
afck added a commit that referenced this pull request Oct 14, 2025
…4797) (#4798)

Backport of #4797.

## Motivation

With the exception of a GraphQL query, the chain state view should only
be accessed by the corresponding chain worker. GraphQL is why the worker
can return a shared chain state view behind a lock, but we are using
that in many other places, too. After
#4769, this is even
more dangerous, as an actor could be dropped and restarted while shared
views are still being used.

## Proposal

Replace several `chain_state_view()` calls with chain info or new chain
worker requests.

Also, extend a comment. (See
#4793 (comment).)

## Test Plan

CI

## Release Plan

- These changes should be released in a new SDK.

## Links

- PR to main: #4797
- [reviewer
checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants