-
Notifications
You must be signed in to change notification settings - Fork 66
Problem: (Fix #1435) No standardized staking event #1449
Problem: (Fix #1435) No standardized staking event #1449
Conversation
3e2c556
to
6d5fa72
Compare
616f316
to
bd5fab0
Compare
Codecov Report
@@ Coverage Diff @@
## master #1449 +/- ##
==========================================
+ Coverage 63.55% 64.44% +0.89%
==========================================
Files 159 160 +1
Lines 21026 21632 +606
==========================================
+ Hits 13363 13941 +578
- Misses 7663 7691 +28
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok, but agree with #1449 (comment) -- processing that only needs TxEnclaveAction
should only get TxEnclaveAction
as input;
processing that needs both can have that top-level TxAction
chain-abci/src/app/validate_tx.rs
Outdated
} | ||
_ => panic!("Trying to execute non-enclave transaction"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this "catch-all" is potentially error-prone if a new enclave tx variant is added and it's not handled here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code updated based on review
How about merge them into one item:
|
bd5fab0
to
7f810cb
Compare
bors try |
🔒 Permission denied Existing reviewers: click here to make calvinlauco a reviewer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok, there may be some minor improvemensts to do down the line
chain-abci/src/staking/table.rs
Outdated
StakedStateAddress, | ||
Coin, | ||
Coin, | ||
PunishmentKind, | ||
Option<Timespec>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be good to have some type alias for this -- also what's difference between the Coin
on the second position and the third position
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created an alias PunishmentKind
and refactored the (Coin, Coin)
pair to SlashedCoin
structure for readability.
bors r+ |
Merge conflict. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a conflict with the latest master
Resolving conflicts now |
1674b60
to
3065b4d
Compare
Conflicts resolved |
3065b4d
to
eda30e3
Compare
bors try |
eda30e3
to
391e90d
Compare
Updated based on TravisCI lint suggestion. |
tryBuild failed: |
bors try |
tryBuild succeeded: |
bors r+ |
1449: Problem: (Fix #1435) No standardized staking event r=tomtau a=calvinlauco Solution: Refactor staking related events to standardized events --- - Remove `RewardsDistribution` and `SlashValidators ` event - Standardized all staking address related actions into `StakingChange` event - Some sample event format (base64 encoded values are decoded) #### Transaction ``` { type: 'StakingChange', attributes: [ { key: 'staking_address', value: '0x2dfde2178daa679508828242119dcf2114038ea8', }, { key: 'staking_optype', value: 'unbond', }, { key: 'staking_diff', value: '[{key:'Bonded',value:"-1000"},{key:"Unbonded",value:"1000"}]' } ] } ``` #### BeginBlock ``` { "begin_block": { "events": [ { "type": "staking_change", "attributes": [ { "key": "staking_address", "value": "MHgyZGZkZTIxNzhkYWE2Nzk1MDg4MjgyNDIxMTlkY2YyMTE0MDM4ZWE4" }, { "key": "staking_optype", "value": "slash" }, { "key": "staking_diff", "value": "[{\"key\":\"Bonded\",\"value\":\"-50000000000\"},{\"key\":\"Unbonded\",\"value\":\"-50000000000\"}]" }, { "key": "staking_opreason", "value": "NonLive" } ] }, { "type": "staking_change", "attributes": [ { "key": "staking_address", "value": "0x45c1851c2f0dc6138935857b9e23b173185fea15" }, { "key": "staking_optype", "value": "reward" }, { "key": "staking_diff", "value": "{\"key\":\"Bonded\",\"value\":\"100000000000\"}" } ] }, { "type": "reward", "attributes": [ { "key": "minted", "value": "\"0\"" } ] } ] } } ``` Co-authored-by: Calvin Lau <[email protected]>
bors r- |
Canceled. |
391e90d
to
5325938
Compare
Updated to add missing |
bors try |
bors r+ |
1449: Problem: (Fix #1435) No standardized staking event r=tomtau a=calvinlauco Solution: Refactor staking related events to standardized events --- - Remove `RewardsDistribution` and `SlashValidators ` event - Standardized all staking address related actions into `StakingChange` event - Some sample event format (base64 encoded values are decoded) #### Transaction ``` { type: 'StakingChange', attributes: [ { key: 'staking_address', value: '0x2dfde2178daa679508828242119dcf2114038ea8', }, { key: 'staking_optype', value: 'unbond', }, { key: 'staking_diff', value: '[{key:'Bonded',value:"-1000"},{key:"Unbonded",value:"1000"}]' } ] } ``` #### BeginBlock ``` { "begin_block": { "events": [ { "type": "staking_change", "attributes": [ { "key": "staking_address", "value": "MHgyZGZkZTIxNzhkYWE2Nzk1MDg4MjgyNDIxMTlkY2YyMTE0MDM4ZWE4" }, { "key": "staking_optype", "value": "slash" }, { "key": "staking_diff", "value": "[{\"key\":\"Bonded\",\"value\":\"-50000000000\"},{\"key\":\"Unbonded\",\"value\":\"-50000000000\"}]" }, { "key": "staking_opreason", "value": "NonLive" } ] }, { "type": "staking_change", "attributes": [ { "key": "staking_address", "value": "0x45c1851c2f0dc6138935857b9e23b173185fea15" }, { "key": "staking_optype", "value": "reward" }, { "key": "staking_diff", "value": "{\"key\":\"Bonded\",\"value\":\"100000000000\"}" } ] }, { "type": "reward", "attributes": [ { "key": "minted", "value": "\"0\"" } ] } ] } } ``` Co-authored-by: Calvin Lau <[email protected]>
Solution: Refactor staking related events to standardized events
5325938
to
bacdb1b
Compare
Canceled. |
@tomtau |
bors r+ |
tryBuild failed: |
This error comes from last |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Build succeeded: |
Solution: Refactor staking related events to standardized events
RewardsDistribution
andSlashValidators
eventStakingChange
eventTransaction
BeginBlock