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

Read version info from server, react accordingly #154

Merged
merged 8 commits into from
Jun 18, 2019

Conversation

yeastplume
Copy link
Member

@yeastplume yeastplume commented Jun 15, 2019

Follow up from mimblewimble/grin#2897 on the wallet side

  • Change v1/pool/push endpoint call to v1/pool/push_tx
  • Add function to read version info from node to NodeClient trait, add implementation to HttpNodeClient
  • On startup, attempt to read version info from node and:
    • If can't communicate with node, continue read only
    • If node reports 404 for v1/version endpoint, assume node is < 2.0.0 and exit
    • If node reports version < what wallet is looking for as a minimum (currently 2.0.0-beta.1), exit with message to upgrade
    • If node reports blockheader version < what wallet is looking for (currently set to 1 for testing, but should be bumped to 2 before releasing), exit with prompt to upgrade

@yeastplume yeastplume added this to the v2.0.0 (HF 1) milestone Jun 15, 2019
@yeastplume
Copy link
Member Author

  • Added a pseudo-middleware function into the foreign API, which accepts a NodeVersionInfo struct and a slate and can return either Ok() or throw a libwallet error that will get propagated properly depending on how the API is instantiated (command line or json-rpc)
  • Changed the get_version_info function for the node client to instead return an option. The http implementation will cache the version info value so it will only be called on the first invocation and the cached value used on subsequent calls
  • Remove block header version check from statup as it can now go into middleware function

@@ -39,6 +39,14 @@ lazy_static! {
HeaderValue::from_str("Basic realm=GrinOwnerAPI").unwrap();
}

fn check_middleware(
Copy link
Member Author

Choose a reason for hiding this comment

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

Middleware goes here (may have to redefine the middleware call to pass in the name of the function as well)

@yeastplume
Copy link
Member Author

yeastplume commented Jun 17, 2019

Added middleware logic, which should work as follows:

  • Pre HF, the wallet should build slates with the version.block_header_version field filled as 1. Post HF, the wallet will fill this field as 2.
  • Pre HF, the wallet foreign_api will allow incoming slates with version.block_header_version set to 1 (and 1 only)
  • Post HF, the wallet foreign_api will stop processing transactions where the incoming slates has its version.block_header_version set to < 2
  • the foreign api's build_coinbase method does not enforce any restrictions (other than the whole wallet needing to run against a 2.0.0 node) (build_coinbase can always be called, and will always be producing the correct proof according to block height)

@yeastplume yeastplume merged commit 6229f3a into mimblewimble:milestone/2.0.0 Jun 18, 2019
garyyu added a commit to gottstech/grin-wallet that referenced this pull request Jun 25, 2019
* V2 slate versioning enablement (mimblewimble#85)

* fix for command line listener port override

* reduce parameter query size

* Add slate versioning

* rustfmt

* bump version number

* Add tests for slate version conversion

* rustfmt

* Updates and test addition based on bdap's review

* rustfmt

* fix mimblewimble#88 (mimblewimble#89)

* Add `check_version` function to Foreign API (mimblewimble#87)

* move api deser types into separate types mod

* rustfmt

* missing types file

* make all exports from libwallet more explicit

* rustfmt

* add version check function to foreign api

* rustfmt

* change check_version return value to result, for consistency

* Revert "Merge branch 'master' into master"

This reverts commit a63f2c7, reversing
changes made to d774272.

* [WIP] Invoiced Transactions API Support (mimblewimble#90)

* basic invoiced tx working

* rustfmt

* teardown

* rustfmt

* rename, new struct for invoice args, begin to add new functions to RPC apis

* rustfmt

* add fns to rpc api

* rustfmt

* owner api functions RPC documentation in place

* rustfmt

* doctests for new invoicing functions

* rustfmt

* test fixes

* update documentation and doctests

* rustfmt

* invoice testing verification of tx log output

* rustfmt

* Add Azure Pipelines to grin-wallet

* Remove cursive and fix task names

* Do not crash on empty terminal

* Add LLVM

* Possible MSFT pipeline bug with . task

* Change connection name

* Command line implementation of invoice commands (mimblewimble#96)

* add issue_invoice_tx command

* rustfmt

* add first pass at process_invoice command

* start of process_invoice fn

* rustfmt

* rename issue invoice and process invoice to invoice and pay

* add prompting and display information to pay invoice command

* rustfmt

* support invoice transactions in finalize command

* rustfmt

* Add Azure Pipelines badge

* Remove duplicate LMDB wallet backend code (mimblewimble#101)

* remove leftover wallet lmdb code

* rustfmt

* Simplify slate (de)serialization (mimblewimble#103)

* Simplify slate (de)serialization

* rustfmt

* Cleanup

* Fix slate version tests

* Another fix for tests

* Fix slate deser in http adapter

* docstring update and provide a bit of a readme (mimblewimble#104)

* Updates for 1.1.0-beta.3 release (mimblewimble#106)

* bump version number and build from tag for beta 3 release

* update for latest grin tag

* Fix keybase adapter (mimblewimble#107)

* fix version string in yml (mimblewimble#113)

* fix: invoice transaction pay need update the slate height (mimblewimble#115)

* Remove double json encoding on http response (mimblewimble#114)

* Add participant ID as part of key to stored private transaction context data (mimblewimble#117)

* add participant_id to saved tranasction context data

* rustfmt?

* change participant id for command line pay command

* change the api repository to grin-wallet instead of grin (mimblewimble#118)

* Test (mimblewimble#119)

* Remove Travis.yml (mimblewimble#124)

* Version Info API Function tweak, remove 'min_compat_version' from slate (mimblewimble#123)

* change slate version function to return list of supported slate formats

* rustfmt

* remove min_compat_version

* Changes for 1.1.0 -> 2.0.0 Deployment strategy decisions (mimblewimble#126)

* make slate v0 the default for regular sends

* add block_header_version to slate

* update doc tests for latest grin version

* rustfmt

* HACF if HF height detected

* rustfmt

* version bump for beta.4

* cargo.lock crate version update, and remove 3 build warning from cargo 1.35.0

* Fix for API secret on node API startup (mimblewimble#131)

* fix for api_secret when reading node height

* rustfmt

* remove macro export

* trigger ci again

* More helpful error message on recover when `wallet_data` dir doesn't exist (mimblewimble#134)

* make recover error message when wallet doesn't exist more helpful

* rustfmt

* fixes and version update for final 1.0.0 build

* fixes and version update for final 1.0.0 build

* create 2.0.0 branch

* V0/V1 Slate Removal + Grin Header Version Bump (mimblewimble#140)

* Remove V0 and V1 Slates from Wallet

* rustfmt

* V1 API + V2 wallet to wallet impl (mimblewimble#144)

* remove v1 API

* rustfmt

* convert http adapter to use V2 api

* rustfmt

* V2 API conversion Pt2 - Check version (mimblewimble#146)

* call check_version on wallet before http send

* rustfmt

* Support new Bulletproof rewind scheme (mimblewimble#122)

* Restore with LegacyProofBuilder

* Switch to ProofBuilder at HF block

* Switch proof builder for coinbase outputs at hard fork

* Use valid_header_version to switch proof builder

* Fix compilation errors

* Use legacy proof builder for AutomatedTesting chain type

* Add macro to avoid duplicate code

* Read version info from server, react accordingly (mimblewimble#154)

* read and parse version, bump hf

* rustfmt

* add foreign api middleware check

* rustfmt

* add middleware checks

* rustfmt

* add check for incoming pre-hf slates

* api tests

* Add double rewind period (mimblewimble#155)

* Add double rewind period

* Simplify restore

* Fix comment

* bump imported version for beta release
yeastplume added a commit that referenced this pull request Jun 27, 2019
* create 2.0.0 branch

* V0/V1 Slate Removal + Grin Header Version Bump (#140)

* Remove V0 and V1 Slates from Wallet

* rustfmt

* V1 API + V2 wallet to wallet impl (#144)

* remove v1 API

* rustfmt

* convert http adapter to use V2 api

* rustfmt

* V2 API conversion Pt2 - Check version (#146)

* call check_version on wallet before http send

* rustfmt

* Support new Bulletproof rewind scheme (#122)

* Restore with LegacyProofBuilder

* Switch to ProofBuilder at HF block

* Switch proof builder for coinbase outputs at hard fork

* Use valid_header_version to switch proof builder

* Fix compilation errors

* Use legacy proof builder for AutomatedTesting chain type

* Add macro to avoid duplicate code

* Read version info from server, react accordingly (#154)

* read and parse version, bump hf

* rustfmt

* add foreign api middleware check

* rustfmt

* add middleware checks

* rustfmt

* add check for incoming pre-hf slates

* api tests

* Add double rewind period (#155)

* Add double rewind period

* Simplify restore

* Fix comment

* bump imported version for beta release

* version bump for next (potential) release

* Provide more specific error when other wallet is outdated (#162)

* add appropriate error message when other wallet is out of date

* rustfmt

* missing cargo.lock
@yeastplume yeastplume deleted the hf_tweaks branch July 8, 2019 09:12
yyangli pushed a commit to mwcproject/mwc-wallet that referenced this pull request May 13, 2020
* create 2.0.0 branch

* V0/V1 Slate Removal + Grin Header Version Bump (mimblewimble#140)

* Remove V0 and V1 Slates from Wallet

* rustfmt

* V1 API + V2 wallet to wallet impl (mimblewimble#144)

* remove v1 API

* rustfmt

* convert http adapter to use V2 api

* rustfmt

* V2 API conversion Pt2 - Check version (mimblewimble#146)

* call check_version on wallet before http send

* rustfmt

* Support new Bulletproof rewind scheme (mimblewimble#122)

* Restore with LegacyProofBuilder

* Switch to ProofBuilder at HF block

* Switch proof builder for coinbase outputs at hard fork

* Use valid_header_version to switch proof builder

* Fix compilation errors

* Use legacy proof builder for AutomatedTesting chain type

* Add macro to avoid duplicate code

* Read version info from server, react accordingly (mimblewimble#154)

* read and parse version, bump hf

* rustfmt

* add foreign api middleware check

* rustfmt

* add middleware checks

* rustfmt

* add check for incoming pre-hf slates

* api tests

* Add double rewind period (mimblewimble#155)

* Add double rewind period

* Simplify restore

* Fix comment

* bump imported version for beta release

* version bump for next (potential) release

* Provide more specific error when other wallet is outdated (mimblewimble#162)

* add appropriate error message when other wallet is out of date

* rustfmt

* missing cargo.lock
antiochp pushed a commit to antiochp/grin-wallet that referenced this pull request Aug 7, 2020
* create 2.0.0 branch

* V0/V1 Slate Removal + Grin Header Version Bump (mimblewimble#140)

* Remove V0 and V1 Slates from Wallet

* rustfmt

* V1 API + V2 wallet to wallet impl (mimblewimble#144)

* remove v1 API

* rustfmt

* convert http adapter to use V2 api

* rustfmt

* V2 API conversion Pt2 - Check version (mimblewimble#146)

* call check_version on wallet before http send

* rustfmt

* Support new Bulletproof rewind scheme (mimblewimble#122)

* Restore with LegacyProofBuilder

* Switch to ProofBuilder at HF block

* Switch proof builder for coinbase outputs at hard fork

* Use valid_header_version to switch proof builder

* Fix compilation errors

* Use legacy proof builder for AutomatedTesting chain type

* Add macro to avoid duplicate code

* Read version info from server, react accordingly (mimblewimble#154)

* read and parse version, bump hf

* rustfmt

* add foreign api middleware check

* rustfmt

* add middleware checks

* rustfmt

* add check for incoming pre-hf slates

* api tests

* Add double rewind period (mimblewimble#155)

* Add double rewind period

* Simplify restore

* Fix comment

* bump imported version for beta release

* version bump for next (potential) release

* Provide more specific error when other wallet is outdated (mimblewimble#162)

* add appropriate error message when other wallet is out of date

* rustfmt

* missing cargo.lock
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