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

Build new contracts on bootstrap, save them in config, load with checks afterward #95

Merged
merged 36 commits into from Sep 8, 2022

Conversation

greenhat
Copy link
Member

@greenhat greenhat commented Aug 10, 2022

Close #92

In this PR:

  • Bootstrap generates a full OracleConfig with updated P2S in contract parameters;
  • *Contract, *ContractInputs, *BoxWrapperInputs got two constructors: create (substitutes constant values in p2s) and load (checks constant values in p2s correspond to the properties);
  • switch from storing *ContractParameters in OracleConfig to *BoxWrapperInputs;
  • remove all addresses in Addresses in favor of OracleConfig::oracle_address;
  • add OracleConfig::rescan_height, set during the bootstrap;

@coveralls
Copy link

coveralls commented Aug 10, 2022

Pull Request Test Coverage Report for Build 3014410921

  • 457 of 567 (80.6%) changed or added relevant lines in 27 files are covered.
  • 61 unchanged lines in 9 files lost coverage.
  • Overall coverage increased (+3.8%) to 69.907%

Changes Missing Coverage Covered Lines Changed/Added Lines %
core/src/cli_commands/vote_update_pool.rs 10 11 90.91%
core/src/cli_commands/update_pool.rs 18 20 90.0%
core/src/state.rs 0 2 0.0%
core/src/api.rs 0 4 0.0%
core/src/cli_commands/bootstrap.rs 52 56 92.86%
core/src/pool_commands.rs 0 4 0.0%
core/src/scans.rs 0 4 0.0%
core/src/contracts/ballot.rs 30 36 83.33%
core/src/contracts/pool.rs 24 30 80.0%
core/src/contracts/update.rs 27 33 81.82%
Files with Coverage Reduction New Missed Lines %
core/src/actions.rs 1 0%
core/src/box_kind/ballot_box.rs 1 90.22%
core/src/cli_commands/bootstrap.rs 1 88.89%
core/src/cli_commands/update_pool.rs 1 73.95%
core/src/serde.rs 1 66.37%
core/src/state.rs 1 0%
core/src/cli_commands/vote_update_pool.rs 2 79.62%
core/src/oracle_state.rs 3 0%
core/src/main.rs 50 0%
Totals Coverage Status
Change from base Build 2969419342: 3.8%
Covered Lines: 2258
Relevant Lines: 3230

💛 - Coveralls

Copy link
Collaborator

@kettlebell kettlebell left a comment

Choose a reason for hiding this comment

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

Looks great! Please check my comments for very minor issues.

Also, I wonder whether we could change the name of the load methods across the crate to something like checked_load, or check_and_load; just as a quick indicator to whoever reads it. What do you think?

core/src/contracts/update.rs Outdated Show resolved Hide resolved
core/src/contracts/pool.rs Outdated Show resolved Hide resolved
core/src/contracts/ballot.rs Outdated Show resolved Hide resolved
core/src/contracts/update.rs Outdated Show resolved Hide resolved
@greenhat
Copy link
Member Author

greenhat commented Sep 8, 2022

Also, I wonder whether we could change the name of the load methods across the crate to something like checked_load, or check_and_load; just as a quick indicator to whoever reads it. What do you think?

I'm glad you mentioned it. I don't like load/create that much myself. checked_load sounds way better! I wonder if changing create to make or build or even substitute would better convey the idea that it's not a generic constructor and it substitutes constants in p2s. What do you think?

@greenhat greenhat closed this Sep 8, 2022
@greenhat greenhat reopened this Sep 8, 2022
@kettlebell
Copy link
Collaborator

I'm glad you mentioned it. I don't like load/create that much myself. checked_load sounds way better! I wonder if changing create to make or build or even substitute would better convey the idea that it's not a generic constructor and it substitutes constants in p2s. What do you think?

How about [create | make | build]_with? So it would be read as 'create with provided args'.

@greenhat
Copy link
Member Author

greenhat commented Sep 8, 2022

Sounds good! Thanks! I like build_with.

greenhat and others added 5 commits September 8, 2022 13:22
Co-authored-by: Tim Ling <tim.ling@gmail.com>
Co-authored-by: Tim Ling <tim.ling@gmail.com>
Co-authored-by: Tim Ling <tim.ling@gmail.com>
Co-authored-by: Tim Ling <tim.ling@gmail.com>
contract parameters and inputs type hierarchy;
Copy link
Collaborator

@kettlebell kettlebell left a comment

Choose a reason for hiding this comment

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

Great, thank you!

@kettlebell kettlebell merged commit 3503db4 into develop Sep 8, 2022
@kettlebell kettlebell deleted the i92 branch September 8, 2022 11:28
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.

Consider separating parameter values from *ContractParameters
3 participants