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

Merge deposit() and contract call() into a single call #1333

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented Jul 7, 2023

This change is picked from #1265. Since #1265 would not be released in pruntime v2.0.2, we may want to pick this runtime ABI breaking change out to release in advance.

In pink query, caller can optionally fill an arbitrary number the the arg deposit which would be deposited to the caller account before calling the contract so that the runtime can finish the gas estimation even the caller doesn't have enough balance in the cluster to pay the execution.

So there were two call to the pink runtime if non-zero deposit was given:

  • runtime.deposit(amout)
  • runtime.call(contract_id)

There is no problem with in memory trie storage. However, for kvdb backend in #1265 we don't implement an extra cache layer for the DB, the effect of the first call runtime.deposit() would be dropped at the time calling runtime.call().

The simplest solution for this issue it merge the to runtime calls into one, that's what this PR does.

@kvinwang kvinwang requested a review from h4x3rotab July 7, 2023 07:02
Copy link
Contributor

@h4x3rotab h4x3rotab left a comment

Choose a reason for hiding this comment

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

LGTM

@kvinwang kvinwang merged commit 35ec059 into master Jul 10, 2023
@kvinwang kvinwang deleted the deposit-in-call branch July 10, 2023 01:50
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.

2 participants