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

First service node test #190

Merged
merged 2 commits into from
Aug 29, 2018
Merged

First service node test #190

merged 2 commits into from
Aug 29, 2018

Conversation

msgmaxim
Copy link

  • Added a first service node test that checks balance after a registration transaction
  • Added a helper function to calculate unlocked balance in tests

@msgmaxim msgmaxim changed the title Service node tests First service node test Aug 28, 2018
@d3987ef8
Copy link

This has some things in it that could change consensus that I haven't tested. Maybe take out the service node list refactoring changes, they can only cause problems. Functions that were added to core are unused also. Sorry maxim I sent you a WIP branch

@msgmaxim
Copy link
Author

Removed untested changes from Jack's commit.

Copy link
Collaborator

@Doy-lee Doy-lee left a comment

Choose a reason for hiding this comment

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

Looks good, looks like now these are all changes isolated from the core code, so good for merge.

@Doy-lee Doy-lee merged commit 93302c1 into oxen-io:dev Aug 29, 2018
@d3987ef8
Copy link

d3987ef8 commented Aug 29, 2018

This test doesn't look finished, it tests that a registration tx can be constructed with the test framework... but a registration tx is just a regular tx, so all this checks in core:: is that a regular tx can be submitted to the blockchain.

Ideally this should at least test e.g. that alice is receiving payouts, and check_stuff should be renamed to check_basic_registration or something.

throw std::runtime_error("couldn't fill transaction cache back destination");
destinations.push_back(de_change);
}

if (change_amount) *change_amount = (cash_back > 0) ? cash_back : 0;

Choose a reason for hiding this comment

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

boost::optional is less bug prone than null pointers @msgmaxim I actually was reminded about this when reading the rust book. I see what you mean now about compile-time reference checks, very cool

Copy link
Author

Choose a reason for hiding this comment

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

Nice! :)

@msgmaxim
Copy link
Author

You are right, the test was not finished. Just yesterday I've modified the make_registration_tx to do the right thing. Should come in the new pull request.

Doy-lee added a commit that referenced this pull request Sep 7, 2018
* core: submit uptime proof immediately after registering

* Increase visibility of autostaking prompts

* quorum_cop: changed uptime proof prune timeout to 2 hours 10 minutes

* cleanup: removed scope limiting block

* check_tx_inputs: fix deregister double spend test to include deregisters from other heights

* config: new testnet network id, genesis tx, and version bump

* wallet2: fix testnet wallet blockheight approximation

* Fix change in address format in RPC which broke parsing and pooling contributors (#184)

* Fix service node endpoints for RPC to also use stdout (#185)

* fixed some further rct core tests (#180)

* Fix service node state by calling detached hooks on failure to switch to alt chain (#188)

* fixed block verification core tests (#186)

* fixed block verification core tests

* core tests: removed gen_block_miner_tx_out_is_small which is only relevant to hardfork version 1

*  Don't consider expired deregistrations when filling block template

* Add unit tests for getting staking requirement (#191)

* First service node test (#190)

* core_tests: added service node tests

* core_tests: check balance after registration tx

* Fix underflow for popping rollback events (#189)

* Move deregistration age check into check_tx_inputs

* Zero initialise rct_signatures member txnFee is a uint64_t and has uninit values

* Enforce that deregisters must be 0 fee since we skip checks

* Add unit tests for vote validation (#193)

* Add unit tests for deregistration validation (#194)

* Mainnet checkpoint 86535, testnet 3591, 4166

* Bump version number

* Add print_sr for getting staking requirement (#198)

* Misc bugfixes (#203)

* removed unnecessary cast to double during txfee+coinbase calculation

* simplewallet: increased autostaking interval from 2 minutes to 40

* Fix casting issues from uint to int (#204)

* core_tests: check service node registration and expiration (#195)

* core_tests: check service node registration and deregistration

* core_tests for service nodes:

- include service nodes rewards when calculating account's balance
- check that service nodes rewards have been received

* fixed namespace error; reduced the scope of staking requirement constants

* On blockchain inc/dec mark deregisters relayble based on age (#201)

* Service nodes restore only 1 rollback bug (#206)

* Fix restore 1 rollback event, ensure prevent rollback is always added

* Remove adding prevent_rollback event at init

It gets called in on block added generic anyway.

* Log db exception, fix relation operators for vote/deregister lifetime (#207)

* Filter relayable deregisters w/ check_tx_inputs instead of blockchain callbacks

* Bump version to 0.3.7-beta

* fix build with GCC 8.1.0 (#211)

* Add temp hardfork rule in testnet for deregister lifetimes (#210)

* Update testnet, remove testnet forks, remove checkpoints, update blockheight estimate (#212)

* Don't ban peers for a bad vote, just drop their connection (#213)

* Update to version 0.3.0 release candidate (#215)
Doy-lee added a commit to Doy-lee/loki that referenced this pull request Sep 7, 2018
* core: submit uptime proof immediately after registering

* Increase visibility of autostaking prompts

* quorum_cop: changed uptime proof prune timeout to 2 hours 10 minutes

* cleanup: removed scope limiting block

* check_tx_inputs: fix deregister double spend test to include deregisters from other heights

* config: new testnet network id, genesis tx, and version bump

* wallet2: fix testnet wallet blockheight approximation

* Fix change in address format in RPC which broke parsing and pooling contributors (oxen-io#184)

* Fix service node endpoints for RPC to also use stdout (oxen-io#185)

* fixed some further rct core tests (oxen-io#180)

* Fix service node state by calling detached hooks on failure to switch to alt chain (oxen-io#188)

* fixed block verification core tests (oxen-io#186)

* fixed block verification core tests

* core tests: removed gen_block_miner_tx_out_is_small which is only relevant to hardfork version 1

*  Don't consider expired deregistrations when filling block template

* Add unit tests for getting staking requirement (oxen-io#191)

* First service node test (oxen-io#190)

* core_tests: added service node tests

* core_tests: check balance after registration tx

* Fix underflow for popping rollback events (oxen-io#189)

* Move deregistration age check into check_tx_inputs

* Zero initialise rct_signatures member txnFee is a uint64_t and has uninit values

* Enforce that deregisters must be 0 fee since we skip checks

* Add unit tests for vote validation (oxen-io#193)

* Add unit tests for deregistration validation (oxen-io#194)

* Mainnet checkpoint 86535, testnet 3591, 4166

* Bump version number

* Add print_sr for getting staking requirement (oxen-io#198)

* Misc bugfixes (oxen-io#203)

* removed unnecessary cast to double during txfee+coinbase calculation

* simplewallet: increased autostaking interval from 2 minutes to 40

* Fix casting issues from uint to int (oxen-io#204)

* core_tests: check service node registration and expiration (oxen-io#195)

* core_tests: check service node registration and deregistration

* core_tests for service nodes:

- include service nodes rewards when calculating account's balance
- check that service nodes rewards have been received

* fixed namespace error; reduced the scope of staking requirement constants

* On blockchain inc/dec mark deregisters relayble based on age (oxen-io#201)

* Service nodes restore only 1 rollback bug (oxen-io#206)

* Fix restore 1 rollback event, ensure prevent rollback is always added

* Remove adding prevent_rollback event at init

It gets called in on block added generic anyway.

* Log db exception, fix relation operators for vote/deregister lifetime (oxen-io#207)

* Filter relayable deregisters w/ check_tx_inputs instead of blockchain callbacks

* Bump version to 0.3.7-beta

* fix build with GCC 8.1.0 (oxen-io#211)

* Add temp hardfork rule in testnet for deregister lifetimes (oxen-io#210)

* Update testnet, remove testnet forks, remove checkpoints, update blockheight estimate (oxen-io#212)

* Don't ban peers for a bad vote, just drop their connection (oxen-io#213)

* Update to version 0.3.0 release candidate (oxen-io#215)
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

3 participants