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

hook(rpc-server): Proxy *poolv1.near contracts on function_call #267

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

kobayurii
Copy link
Collaborator

@kobayurii kobayurii commented Jun 4, 2024

The temporary solution is to avoid a lot of read queries to the database.

During contract execution, we provide the host function to the contract runner, which fetches the key directly from ScyllaDB. This works great for most contracts that require a few keys during execution.

The problem with this approach shows itself during the Staking Pool contract call of the method get_accounts

pub fn get_accounts(&self, from_index: u64, limit: u64) -> Vec<HumanReadableAccount> {
    let keys = self.accounts.keys_as_vector();

    (from_index..std::cmp::min(from_index + limit, keys.len()))
        .map(|index| self.get_account(keys.get(index).unwrap()))
        .collect()
}

@kobayurii kobayurii changed the title hook for poolv1.near hook(rpc-server): Proxy *poolv1.near contracts on function_call Jun 4, 2024
@kobayurii kobayurii requested a review from khorolets June 4, 2024 16:05
@kobayurii kobayurii self-assigned this Jun 4, 2024
@kobayurii kobayurii marked this pull request as ready for review June 4, 2024 16:09
@kobayurii kobayurii merged commit d4766c2 into develop Jun 4, 2024
3 checks passed
kobayurii added a commit that referenced this pull request Jun 5, 2024
* fix(near-state-indexer): Fix the TypeError in communication with Redis leading to spam of warnings (#254)

* (rpc_server): metrics refactoring and improvements (#255)

* merics reffactoring and imrovements

* metrics improvements according pr comments

* improvement tracing instrument logs (#257)

* (database): Implement metrics to count requests for each table (#259)

* Implement metrics to count request for each database table

* remove logic to fetch all state before contract call

* add issue to implement metrics for postgres

* rename mentric DATABASE_QUERIES to DATABASE_READ_QUERIES

* refactor(rpc-server): Tweaks and clean up around query.call_function method implementation (#258)

* refactor(rpc-server): Tweaks and clean up around query.call_function method implementation

* Follow the clippy suggestion

* Drop redundant pieces of code

* fix tx different results (#261)

* Metrics(rpc-server): Extend metrics (#263)

* extend metrics to collect block category

* fmt

* code improvement according git comments

* Revert "fix tx different results" (#265)

This reverts commit 2e4dc30.

* feat: added `view_receipt_record` rpc endpoint (#266)

* feat: added `view_receipt_record` rpc endpoint

* chore: removed leftovers

* feat: used appropriate metrics

* feat: added proper response structure

* docs(view_receipt_record): added new custom method

* hook for poolv1.near (#267)

* chore: relese v0.2.9 (#268)

* proxy next_light_client_block to regular rpc (#269)

* fix changelog.md (#270)

---------

Co-authored-by: Bohdan Khorolets <[email protected]>
Co-authored-by: Ivan Frolov <[email protected]>
@kobayurii kobayurii deleted the poolv1-hook branch June 5, 2024 08:36
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.

None yet

2 participants