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

Move rewards to runtime #1497

Merged
merged 8 commits into from
Oct 22, 2019
Merged

Conversation

evgenykuzyakov
Copy link
Collaborator

  • Move validator account update to Runtime from NightshadeRuntime.
  • Update .apply API to avoid clone issue.
  • Move check_balance to its own crate.
  • Add test for the clone issue.
  • Remove clone clutch.
  • Fix double rewards for a treasury account staking.

Fixes #1481

near/src/runtime.rs Show resolved Hide resolved
runtime/runtime/src/lib.rs Show resolved Hide resolved
runtime/runtime/src/lib.rs Outdated Show resolved Hide resolved
apply_state: &ApplyState,
prev_receipts: &[Receipt],
transactions: &[SignedTransaction],
) -> Result<ApplyResult, InvalidTxErrorOrStorageError> {
// TODO(#1481): Remove clone after Runtime bug is fixed.
let initial_state = state_update.clone();
let initial_state = TrieUpdate::new(trie.clone(), root);
Copy link
Contributor

Choose a reason for hiding this comment

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

@Kouprin Is working on trie parts. His abstraction requires encapsulating root in StateRoot instead of exposing it as a hash directly. We might want to avoid working with root hashes directly in the runtime.

Copy link
Collaborator Author

@evgenykuzyakov evgenykuzyakov Oct 21, 2019

Choose a reason for hiding this comment

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

I was wondered what exactly should be used here. Seems most places still use hash, so I decided to use the hash instead of the StateRoot.
Right now TrieUpdate takes hash for the root, so it's better to pass the hash for now.

Evgeny Kuzyakov and others added 3 commits October 21, 2019 15:01
Co-Authored-By: Maksym Zavershynskyi <35039879+nearmax@users.noreply.github.com>
@nearprotocol-bulldozer nearprotocol-bulldozer bot merged commit af08ba9 into staging Oct 22, 2019
@nearprotocol-bulldozer nearprotocol-bulldozer bot deleted the move-rewards-to-runtime branch October 22, 2019 19:01
frol pushed a commit that referenced this pull request Oct 22, 2019
* Move validator rewards to runtime
* Merge branch 'staging' of github.com:nearprotocol/nearcore into move-rewards-to-runtime
* Merge branch 'staging' of github.com:nearprotocol/nearcore into move-rewards-to-runtime
* Update runtime/runtime/src/lib.rs

Co-Authored-By: Maksym Zavershynskyi <35039879+nearmax@users.noreply.github.com>
* Merge branch 'staging' of github.com:nearprotocol/nearcore into move-rewards-to-runtime
* Merge branch 'move-rewards-to-runtime' of github.com:nearprotocol/nearcore into move-rewards-to-runtime
* Merge branch 'staging' into move-rewards-to-runtime
* Merge refs/heads/staging into move-rewards-to-runtime
bowenwang1996 added a commit that referenced this pull request Oct 30, 2019
* Dont panic for check balance (#1493)

* Introduce BalanceMismatch error
* Merge branch 'staging' of github.com:nearprotocol/nearcore into dont-panic-for-check-balance
* Merge branch 'staging' of github.com:nearprotocol/nearcore into dont-panic-for-check-balance
* Merge bug
* Merge branch 'staging' into dont-panic-for-check-balance
* Merge refs/heads/staging into dont-panic-for-check-balance
* Merge refs/heads/staging into dont-panic-for-check-balance
* Merge refs/heads/staging into dont-panic-for-check-balance
* Merge branch 'staging' of github.com:nearprotocol/nearcore into dont-panic-for-check-balance
* Merge branch 'dont-panic-for-check-balance' of github.com:nearprotocol/nearcore into dont-panic-for-check-balance

* Merge master into staging (#1511)

* Give more money to test.near (#1467)

* Give more money to test.near

* Bump version

* Reset state and bump version (#1499)

* Bump version for Borsh (#1502)

* Fix boot node in start_testnet.py (#1505)

* Reduce total supply and adjust parameters (#1508)

* Update dependency to avoid vulnerabilities (#1509)

* Update dependency to avoid vulnerabilities

* Remove serde_cbor

* pytest for remote node (#1437)

* gcloud lib and init/start cluster
* Merge branch 'staging' into pytest-remote
* a few fixes
* almost done
* a few more fix
* Merge branch 'staging' into pytest-remote
* more fix
* more tests
* more fix and tests
* Merge branch 'staging' into pytest-remote
* Merge branch 'staging' into pytest-remote
* Merge refs/heads/staging into pytest-remote
* Merge refs/heads/staging into pytest-remote
* Merge refs/heads/staging into pytest-remote
* Merge refs/heads/staging into pytest-remote
* Merge refs/heads/staging into pytest-remote
* Merge refs/heads/staging into pytest-remote
* Merge refs/heads/staging into pytest-remote
* Merge branch 'staging' into pytest-remote
* Merge branch 'staging' into pytest-remote
* add requirements.txt
* a few fixes
* remote version of block_production works
* Merge branch 'pytest-remote' of github.com:nearprotocol/nearcore into pytest-remote
* Merge branch 'staging' into pytest-remote
* update requirements.txt

* Remove some unnecessary unsafe code (#1512)

* Remove some unnecessary unsafe code
* Merge refs/heads/staging into remove-unsafe-code
* Merge refs/heads/staging into remove-unsafe-code

* Chaos Monkey now messes up with network (#1514)

* Chaos Monkey now messes up with network

* Fixing a typo

* Adding missing shell command

* Marking `local_network` monkey as existing

* Adding one of the new tests that was previously missing

* Handle head method for status check (#1513)

* fix head status check
* Merge branch 'staging' into handle-head-method
* Merge refs/heads/staging into handle-head-method
* Merge refs/heads/staging into handle-head-method

* recover system coredump by Misha for minimize docker image (#1528)

* recover system coredump by Misha for minimize docker image

* Move rewards to runtime (#1497)

* Move validator rewards to runtime
* Merge branch 'staging' of github.com:nearprotocol/nearcore into move-rewards-to-runtime
* Merge branch 'staging' of github.com:nearprotocol/nearcore into move-rewards-to-runtime
* Update runtime/runtime/src/lib.rs

Co-Authored-By: Maksym Zavershynskyi <35039879+nearmax@users.noreply.github.com>
* Merge branch 'staging' of github.com:nearprotocol/nearcore into move-rewards-to-runtime
* Merge branch 'move-rewards-to-runtime' of github.com:nearprotocol/nearcore into move-rewards-to-runtime
* Merge branch 'staging' into move-rewards-to-runtime
* Merge refs/heads/staging into move-rewards-to-runtime

* Fix a dependency (#1527)

* Fix a dependency

eth-secp256k1 got renamed to parity-secp256k1
* Merge refs/heads/staging into fix_build

* update rust-toolchain (#1529)

* update rust-toolchain

* Fix some warnings (#1530)

* Fix some warnings
* More warnings

* Introduced `chunk` API (#1524