Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

Problem: (CRO-294) Client can generate invalid transactions#537

Merged
bors[bot] merged 1 commit intocrypto-com:masterfrom
devashishdxt:tx-validity
Oct 31, 2019
Merged

Problem: (CRO-294) Client can generate invalid transactions#537
bors[bot] merged 1 commit intocrypto-com:masterfrom
devashishdxt:tx-validity

Conversation

@devashishdxt
Copy link
Copy Markdown
Contributor

Solution: Added balance checks when creating network ops transactions

Solution: Added balance checks when creating network ops transactions
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 30, 2019

Codecov Report

Merging #537 into master will decrease coverage by <.01%.
The diff coverage is 71.42%.

@@            Coverage Diff             @@
##           master     #537      +/-   ##
==========================================
- Coverage   67.23%   67.22%   -0.01%     
==========================================
  Files         122      122              
  Lines       14102    14129      +27     
==========================================
+ Hits         9481     9498      +17     
- Misses       4621     4631      +10
Impacted Files Coverage Δ
client-cli/src/command.rs 0% <0%> (ø) ⬆️
client-core/src/service/wallet_state_service.rs 89.17% <100%> (+0.28%) ⬆️
client-core/src/wallet/default_wallet_client.rs 59.12% <100%> (+0.82%) ⬆️
...work/src/network_ops/default_network_ops_client.rs 85.81% <65.21%> (-1.41%) ⬇️
chain-core/src/tx/fee/mod.rs 87.68% <0%> (-0.5%) ⬇️

Copy link
Copy Markdown
Contributor

@tomtau tomtau left a comment

Choose a reason for hiding this comment

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

looks ok, but is it only for staked state operations?
e.g. if one sends TX that spends some tx inputs... if the client doesn't sync, those inputs would still be "unspent" in the internal state (rather than "potentially spent" with some TXID to check whether it was really committed), is that correct?

@devashishdxt
Copy link
Copy Markdown
Contributor Author

looks ok, but is it only for staked state operations?
e.g. if one sends TX that spends some tx inputs... if the client doesn't sync, those inputs would still be "unspent" in the internal state (rather than "potentially spent" with some TXID to check whether it was really committed), is that correct?

That is correct. Client won't know if some inputs are spent until it syncs the block in which they were spent.

@tomtau
Copy link
Copy Markdown
Contributor

tomtau commented Oct 30, 2019

looks ok, but is it only for staked state operations?
e.g. if one sends TX that spends some tx inputs... if the client doesn't sync, those inputs would still be "unspent" in the internal state (rather than "potentially spent" with some TXID to check whether it was really committed), is that correct?

That is correct. Client won't know if some inputs are spent until it syncs the block in which they were spent.

ok, I created CRO-524 for that

@tomtau
Copy link
Copy Markdown
Contributor

tomtau commented Oct 30, 2019

bors r+

Copy link
Copy Markdown
Collaborator

@calvinaco calvinaco left a comment

Choose a reason for hiding this comment

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

Look good to me, leave a small suggestion about using view_key when checking wallet existence.

inputs: &[TxoPointer],
) -> Result<bool> {
// Check if wallet exists
self.wallet_service.view_key(name, passphrase)?;
Copy link
Copy Markdown
Collaborator

@calvinaco calvinaco Oct 30, 2019

Choose a reason for hiding this comment

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

A small suggestion: I notice we are using view_key to check for wallet existence or passphrase correctness in wallet client, maybe we can add a wallet_service.has_wallet() ?

bors bot added a commit that referenced this pull request Oct 30, 2019
535: Problem(CRO-392)outdated dependencies in client's storage encryption r=tomtau a=linfeng-crypto

Solution:
- use crate `aes-gcm-siv` and `aead` instead of `miscreant`
- use crate `rust-argon2` to the `passphrase` to a constant length,  and store the `salt` at the end of the encrypted data.



537: Problem: (CRO-294) Client can generate invalid transactions r=tomtau a=devashishdxt

Solution: Added balance checks when creating network ops transactions

538: Problem:(CRO-521) Problem: unbonded from custom time is ignored in genesis initconfig r=tomtau a=linfeng-crypto

Solution: 
change the parameters of `new_init`: change `genesis_time` from `Timespec` into `Option<Timespec>`, remove the `bool` type parameter `bonded`, add a `&StakedStateDestination` type parameter.

Co-authored-by: ylf <cxwcylf@126.com>
Co-authored-by: Devashish Dixit <devashish@crypto.com>
Co-authored-by: linfeng <linfeng@crypto.com>
@bors
Copy link
Copy Markdown
Contributor

bors bot commented Oct 30, 2019

Build failed (retrying...)

Copy link
Copy Markdown
Collaborator

@leejw51crypto leejw51crypto left a comment

Choose a reason for hiding this comment

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

ok

bors bot added a commit that referenced this pull request Oct 30, 2019
537: Problem: (CRO-294) Client can generate invalid transactions r=tomtau a=devashishdxt

Solution: Added balance checks when creating network ops transactions

Co-authored-by: Devashish Dixit <devashish@crypto.com>
@devashishdxt
Copy link
Copy Markdown
Contributor Author

bors retry

@bors
Copy link
Copy Markdown
Contributor

bors bot commented Oct 30, 2019

Already running a review

@bors
Copy link
Copy Markdown
Contributor

bors bot commented Oct 30, 2019

Build failed

@tomtau
Copy link
Copy Markdown
Contributor

tomtau commented Oct 31, 2019

bors retry

bors bot added a commit that referenced this pull request Oct 31, 2019
537: Problem: (CRO-294) Client can generate invalid transactions r=tomtau a=devashishdxt

Solution: Added balance checks when creating network ops transactions

538: Problem:(CRO-521) Problem: unbonded from custom time is ignored in genesis initconfig r=tomtau a=linfeng-crypto

Solution: 
change the parameters of `new_init`: change `genesis_time` from `Timespec` into `Option<Timespec>`, remove the `bool` type parameter `bonded`, add a `&StakedStateDestination` type parameter.

540: Problem: (CRO-501) Integration tests is not running in HW SGX r=tomtau a=calvinlauco

Solution: Add integration tests in Drone CI running in HW SGX

---
- Integration tests will run as SW mode in TravisCI and HW mode in Drone

Co-authored-by: Devashish Dixit <devashish@crypto.com>
Co-authored-by: linfeng <linfeng@crypto.com>
Co-authored-by: Calvin Lau <calvinlauco@gmail.com>
@bors
Copy link
Copy Markdown
Contributor

bors bot commented Oct 31, 2019

Build failed (retrying...)

bors bot added a commit that referenced this pull request Oct 31, 2019
537: Problem: (CRO-294) Client can generate invalid transactions r=tomtau a=devashishdxt

Solution: Added balance checks when creating network ops transactions

Co-authored-by: Devashish Dixit <devashish@crypto.com>
@tomtau
Copy link
Copy Markdown
Contributor

tomtau commented Oct 31, 2019

bors r+

bors bot added a commit that referenced this pull request Oct 31, 2019
537: Problem: (CRO-294) Client can generate invalid transactions r=tomtau a=devashishdxt

Solution: Added balance checks when creating network ops transactions

542: Problem: app hash changes even if app state didn't change (CRO-526) r=tomtau a=tomtau

Solution: added a flag to chainabci node to signal whether rewards pool was updated
in that block (either by slashing events or transaction fees -- in the future reward distribution),
so that its "last_block_height" (which denotes when it was updated last time)
is only updated when the amount changed.
TODO: perhaps move the rewards pool update logic to rewards pool code (rather than in abci)?

Co-authored-by: Devashish Dixit <devashish@crypto.com>
Co-authored-by: Tomas Tauber <2410580+tomtau@users.noreply.github.com>
@bors
Copy link
Copy Markdown
Contributor

bors bot commented Oct 31, 2019

@bors bors bot merged commit 44abaad into crypto-com:master Oct 31, 2019
@devashishdxt devashishdxt deleted the tx-validity branch October 31, 2019 07:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants