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

soroban-rpc: evict ledger entries #925

Closed
wants to merge 3 commits into from

Conversation

2opremio
Copy link
Contributor

@2opremio 2opremio commented Sep 5, 2023

What

Evict ledger entries when Core signals so through txmeta

Why

Fixes #914

Known limitations

The eviction test I added doesn't succeed after more than 10 minutes. Either there is something wrong in Core or the eviction takes too long to be testeable. I won't merge until that has been figured out.

if ledgerCloseMeta.V != 2 {
return fmt.Errorf("unexpected close meta version: %d", ledgerCloseMeta.V)
}
keysToEvict := make([]xdr.LedgerKey, len(ledgerCloseMeta.V2.EvictedTemporaryLedgerKeys)+len(ledgerCloseMeta.V2.EvictedPersistentLedgerEntries))
Copy link
Contributor

Choose a reason for hiding this comment

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

we only need to process evicted temporary ledger keys because the evicted persistent ledger entries are already included in the change reader stream, see stellar/go#5037

I just started working on a similar pr which only handles temporary ledger key eviction https://github.com/stellar/soroban-tools/pull/926/files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately we can't transparently delete persistent ledger entries though (see TODO comment below) so I will need to detect them anyways.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that you both are correct here, and the solution should be "other". In a similar way to core, we need to find a way ( or maybe not ? ) to help generate the restorefootprint for evicted ledger entries. however, that doesn't need to be handled in the same way. Core are going to store large bloom filters to accomodate that.
For the time being, no permanent entry is going to be evicted. however, before it does - we need to figure out how we address that.

@@ -41,6 +41,17 @@ impl Contract {
env.storage().persistent().set(&COUNTER, &count);
}

pub fn inc_tmp(env: Env) {
let mut count: u32 = env.storage().temporary().get(&COUNTER).unwrap_or(0); // Panic if the value of COUNTER is not u32.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be great if this change to the counter would be to a completely new key ( i.e. "TMP_COUNTER" ), so that we can be sure that we're testing the right thing.

Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

just one comment about the test contract change.

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.

soroban-rpc: evict temporary ledger entries
4 participants