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

Implement Budget DSL in terms of Call and PageTable #739

Closed

Conversation

aeyakovenko
Copy link
Member

@aeyakovenko aeyakovenko commented Jul 24, 2018

  • Implements a PageTable which is a data structure for mapping PublicKey -> Page
  • Defines a ContractId, which is a PublicKey of the contract
  • A Page defines a memory region, and holds a balance of tokens
  • Pages can be assigned to a Contract. This is conceptually similar to mapping physical memory to a process.
  • Runtime will pull up transactions and execute them in parallel if they have no overlap
  • top bench performance for simple spends is with a thread group of 4-8, and around 500ktps. (more optimization ideas are possible)
    Another way to think of the model is a single address space OS with memory protection for processes.

decisions to be made

  • do a signature check like current bank, or use a version in the spenders Page structure?

A version in the Page structure means that a spender has to know the current version, and only a single transaction that matches it will be executed.

if we use a version, it nearly impossible for the spender to asynchronously post a bunch of transactions and only retry the failed ones. Spender would send transactions with version 0, 1, 2, 3, 4
if 2 is dropped or arrives out of order, 3, and 4 are likely to be dropped as well.

This is how I currently implemented Page, but I am having second thoughts. Especially since asynchronous signals will not be able to predict what the version of the Page is.

  • Parallelize blobs, or process multiple blobs in parallel but each blob sequentially.

PageTable locks memory per transaction, that means that the blobs output is parallelizable for the blob.

But performance is better when we have multiple blobs of transactions processed at the same time. this means that blobs can lock memory for the blob, and process transactions in series. maybe we have different queues, for contracts that are expensive or cheap to serialize?

@aeyakovenko aeyakovenko added work in progress This isn't quite right yet noCI Suppress CI on this Pull Request labels Jul 24, 2018
@aeyakovenko aeyakovenko requested a review from garious July 24, 2018 02:52
@aeyakovenko aeyakovenko added rfc and removed rfc labels Jul 24, 2018
@aeyakovenko aeyakovenko changed the title Transaction in terms of call Transaction and Bank in terms of Call and PageTable Jul 25, 2018
@aeyakovenko aeyakovenko removed the noCI Suppress CI on this Pull Request label Jul 31, 2018
@aeyakovenko aeyakovenko force-pushed the transaction_in_terms_of_call branch from e6be112 to 40ac352 Compare July 31, 2018 03:17
@garious
Copy link
Contributor

garious commented Jul 31, 2018

Why do you implement Transaction in terms of Call and not Instruction?

@aeyakovenko
Copy link
Member Author

@garious Transaction was the interface that we used over the wire. I think we can remove it and just have Instruction as the bank contract specific user data.

@garious
Copy link
Contributor

garious commented Jul 31, 2018

@aeyakovenko, I'm just to get my head around how this should relate to @carllin's work to support multiple instructions in: #602

@garious garious changed the title Transaction and Bank in terms of Call and PageTable Implement Budget DSL in terms of Call and PageTable Jul 31, 2018
@aeyakovenko
Copy link
Member Author

@garious The main change is that the to address needs to be supplied for the state transitions in the contract. Because the state is stored in the memory that belongs to the to page. So if you want to modify multiple contracts at once, you would need to pass a set of keys, which Call supports. All the pages will get loaded and passed to the contract method.

@aeyakovenko aeyakovenko force-pushed the transaction_in_terms_of_call branch from 11d808c to 3946569 Compare August 4, 2018 05:57
more fast ledger ideas

porting transaction to call

bank in terms of page_table

page_table tests pass

use PACKET_DATA_SIZE instead of 256

timestamp contract works!

transfer works!

more bank tests pass

filter bad last ids

fix experimental benches

last_id_not_found error

fixed replicate test

thin client test

renable benches

retry thin client requests

fix purge test

shrink the call a bit

clippy

tests

clippy

store the last signature of the caller using the page

dynamic works i think

have thin client implement version retry

rebase

tests
@aeyakovenko aeyakovenko force-pushed the transaction_in_terms_of_call branch from 3946569 to f09f520 Compare August 4, 2018 15:05
@garious
Copy link
Contributor

garious commented Aug 13, 2018

@aeyakovenko, close this PR since it's coming in as separate smaller PRs?

@aeyakovenko
Copy link
Member Author

#953 is taking over this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work in progress This isn't quite right yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants