Skip to content

Conversation

abarmat
Copy link
Contributor

@abarmat abarmat commented Jun 24, 2020

@abarmat abarmat marked this pull request as ready for review June 30, 2020 17:24
abarmat added 11 commits June 30, 2020 14:26
- rename functions related to settlement and allocations
- use interfaces for staking
- reorg tests
- purge allocation
- add tests and validations
- add channelID in collect to avoid overwritting channel proxy on allocation
- refactor how channel proxies are stored
@abarmat abarmat force-pushed the ariel/reallocate branch from 8d2a291 to f087523 Compare June 30, 2020 17:59
- add test for withdrawal fees
- add test for conservation of token to signal exchange
- improve state storage to take less space
@abarmat abarmat changed the title ariel: channel allocation and settlement staking: channel allocation and settlement Jun 30, 2020

// TODO: find a rebate pool for the epoch and accumulate stuff there
// TODO: review if we can replace Settlement with Allocation
// TODO: can we unallocate two Allocations on the same epoch - rebate?
Copy link

Choose a reason for hiding this comment

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

If we do support multiple allocations per Indexer + subgraph, then I think it's okay to have multiple settlements on the same epoch.

abarmat and others added 2 commits July 1, 2020 23:41
- make state transitions clearer
- add build to test pipeline
- remove grace period
* connext: minor changes and cleanup
* connext: adapt contracts and tests to new `Staking#collect`

Co-authored-by: Heiko Fisch <heiko.fisch@gmail.com>
Copy link
Contributor

@davekay100 davekay100 left a comment

Choose a reason for hiding this comment

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

Looks pretty good, some small comments and changes


// When all settlements processed then prune rebate pool
if (pool.settlementsCount == 0) {
delete rebates[_epoch];
delete rebates[alloc.settledAtEpoch];
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the new way we record and store allocation amounts. it seems much less complex.

I am thinking maybe we should implement some asserts() somewhere, in a different PR.

Just so we can avoid sceanarios where , maybe there is a bug, and someone can withdraw more than they should be able to. and we know the token allocations or fees we are recording should never go below 0, or it shouldnt hit 0 unless settlement counts is also 0.

I am thinking we could make a linear task, and do this in the future

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, let's do that.

Comment on lines +823 to +824
alloc.collectedFees = 0;
alloc.effectiveAllocation = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if @Zerim wants to keep either of these, possibly for time-weighted calculations , for indexer reputation?

Copy link
Contributor

Choose a reason for hiding this comment

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

are we setting these to 0 to save space? Does this get a gas refund?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm setting those to zero to unallocate that storage, as a good Ethereum citizen. I was thinking to selectively leave information we need later, maybe when we review the indexing rewards. For all the rest we have the subgraph :)

Copy link
Contributor

Choose a reason for hiding this comment

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

lets leave it as is for now, and we can add it back in if needed

@abarmat abarmat merged commit df1e51a into master Jul 7, 2020
@abarmat abarmat deleted the ariel/reallocate branch July 7, 2020 00:48
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.

3 participants