Skip to content

STR-1344: rpc state cache does not get updated #142

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

Merged
merged 6 commits into from
May 14, 2025

Conversation

storopoli
Copy link
Member

@storopoli storopoli commented May 13, 2025

Description

Turns out that the RPC server was trying to deserialize the MachineState as ContractState. That would never had worked.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor
  • New or updated tests
  • Dependency Update

Notes to Reviewers

The duty tracker serializes all the contracts:

bridge-1-1          | 2025-05-14T19:13:20.780672Z DEBUG duty_tracker::contract_persister: committing all active contracts num_contracts=1
bridge-1-1          | 2025-05-14T19:13:40.848958Z  INFO alpen_bridge::rpc_server: initializing the RPC server initial contract cache fill before_num_contracts=1
bridge-1-1          | 2025-05-14T19:13:40.863640Z DEBUG alpen_bridge::rpc_server: Contracts cache refreshed after_num_contracts=1

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added (where necessary) tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

Related Issues

STR-1344

@storopoli storopoli force-pushed the STR-1344-RPC-state-cache-does-not-get-updated branch 2 times, most recently from f93f4e0 to a4b608b Compare May 13, 2025 18:06
@storopoli storopoli force-pushed the STR-1344-RPC-state-cache-does-not-get-updated branch from a4b608b to 34e6630 Compare May 13, 2025 18:07
@storopoli storopoli self-assigned this May 13, 2025
@storopoli storopoli added bugfix Something isn't working P0 - Blocks Development labels May 13, 2025
Copy link

codecov bot commented May 13, 2025

Codecov Report

Attention: Patch coverage is 4.21053% with 91 lines in your changes missing coverage. Please review.

Project coverage is 51.66%. Comparing base (9d7d79f) to head (b6a45a4).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
bin/alpen-bridge/src/rpc_server.rs 0.00% 82 Missing ⚠️
bin/alpen-bridge/src/mode/operator.rs 0.00% 6 Missing ⚠️
crates/duty-tracker/src/contract_persister.rs 0.00% 3 Missing ⚠️
@@            Coverage Diff             @@
##             main     #142      +/-   ##
==========================================
- Coverage   51.86%   51.66%   -0.21%     
==========================================
  Files         147      147              
  Lines       24675    24783     +108     
==========================================
+ Hits        12798    12803       +5     
- Misses      11877    11980     +103     
Files with missing lines Coverage Δ
bin/alpen-bridge/src/config.rs 95.23% <100.00%> (+0.23%) ⬆️
crates/duty-tracker/src/contract_persister.rs 0.00% <0.00%> (ø)
bin/alpen-bridge/src/mode/operator.rs 0.00% <0.00%> (ø)
bin/alpen-bridge/src/rpc_server.rs 0.00% <0.00%> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@storopoli storopoli force-pushed the STR-1344-RPC-state-cache-does-not-get-updated branch from 3d66aca to 1d2c332 Compare May 13, 2025 20:35
@storopoli storopoli force-pushed the STR-1344-RPC-state-cache-does-not-get-updated branch from 1d2c332 to b6a45a4 Compare May 14, 2025 19:15
@storopoli storopoli requested review from Rajil1213 and ProofOfKeags and removed request for Rajil1213 May 14, 2025 19:19
@storopoli storopoli marked this pull request as ready for review May 14, 2025 19:19
@storopoli storopoli requested a review from Rajil1213 May 14, 2025 19:19

let mut cache_lock = cached_contracts.write().await;
*cache_lock = refreshed_contracts;
// drop the lock!
Copy link
Contributor

Choose a reason for hiding this comment

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

don't leave redundant comments lol

Copy link
Member Author

Choose a reason for hiding this comment

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

redundant!? You don't know how many times I've got burned by a lock? At Alpen I think I've seen at least 2 times. I'm gonna die in this hill, this is not redundant. I'll remove the comment once we have STM-ish lock-free data structures in the Bridge 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

no what I mean is that the comment provides no additional value over just dropping the lock

@ProofOfKeags ProofOfKeags added this pull request to the merge queue May 14, 2025
Merged via the queue into main with commit f5b6273 May 14, 2025
13 checks passed
@ProofOfKeags ProofOfKeags deleted the STR-1344-RPC-state-cache-does-not-get-updated branch May 14, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Something isn't working P0 - Blocks Development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants