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

Postage BatchStore and BatchService #1070

Merged
merged 17 commits into from
Jan 13, 2021

Conversation

paxthemax
Copy link
Contributor

@paxthemax paxthemax commented Dec 23, 2020

Description

This PR tracks the initial implementation to the postage BatchStorer and EventUpdater interfaces

  • BatchStore handles storage of batches and ChainState via a storer interface
  • BatchService implements the postage.EventUpdater interface and manages the business logic of postage batches

This should provide the skeleton for further features in the postage package.

related to #1046 #922 and parts of #934

@paxthemax paxthemax self-assigned this Dec 23, 2020
@paxthemax
Copy link
Contributor Author

NOTE: this PR is still in a draft state until it is fully integrated with the rest of the codebase.

@acud acud changed the base branch from master to storage-incentives December 24, 2020 10:37
@acud
Copy link
Member

acud commented Dec 24, 2020

@paxthemax thanks.
I changed base to storage-incentives. Please note @zelig already reviewed this code in #1069 (which will be now closed in favor of this PR). Please have a look at this comments. Also if you could go through the files added and add missing copyrights (some are missing), thanks

@acud
Copy link
Member

acud commented Dec 24, 2020

Also, please note that the build is failing

@paxthemax
Copy link
Contributor Author

Sorry for the confusion. I will acknowledge the comments from #1069.

Also, I will remove the PR from draft once the build is fixed.

@paxthemax paxthemax force-pushed the feature/postage-batchstore-batchservice branch from 897ddf3 to e458bff Compare December 24, 2020 16:50
pkg/postage/testing/batch.go Outdated Show resolved Hide resolved
pkg/postage/testing/chainstate.go Outdated Show resolved Hide resolved
pkg/postage/stamp_test.go Outdated Show resolved Hide resolved
pkg/postage/stamp.go Outdated Show resolved Hide resolved
pkg/postage/batchstore/store.go Outdated Show resolved Hide resolved
pkg/postage/chainstate.go Show resolved Hide resolved
pkg/postage/chainstate.go Outdated Show resolved Hide resolved
pkg/postage/interface.go Show resolved Hide resolved
pkg/postage/interface.go Outdated Show resolved Hide resolved
pkg/postage/interface.go Outdated Show resolved Hide resolved
@paxthemax paxthemax force-pushed the feature/postage-batchstore-batchservice branch 3 times, most recently from ba4ef6d to 96b91b6 Compare January 5, 2021 09:39
Copy link
Member

@zelig zelig left a comment

Choose a reason for hiding this comment

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

please check my comments on the previous version of the PR

pkg/postage/batchservice/batchservice.go Outdated Show resolved Hide resolved
pkg/postage/batchservice/batchservice.go Show resolved Hide resolved
@paxthemax paxthemax force-pushed the feature/postage-batchstore-batchservice branch from dca5701 to 08982c7 Compare January 8, 2021 09:44
@paxthemax paxthemax force-pushed the feature/postage-batchstore-batchservice branch from ad920b6 to 641f449 Compare January 8, 2021 10:02
@paxthemax paxthemax marked this pull request as ready for review January 10, 2021 14:48
@paxthemax paxthemax requested a review from acud January 10, 2021 14:48
Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

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

Looks very solid, thank you very much. Minor nitpicking included

pkg/postage/batch.go Outdated Show resolved Hide resolved
pkg/postage/batchservice/batchservice.go Outdated Show resolved Hide resolved
pkg/postage/batchservice/batchservice_test.go Outdated Show resolved Hide resolved
pkg/postage/batchstore/mock/store.go Show resolved Hide resolved
pkg/postage/batchstore/mock/store_test.go Outdated Show resolved Hide resolved
pkg/postage/testing/batch.go Outdated Show resolved Hide resolved
pkg/postage/testing/chainstate.go Outdated Show resolved Hide resolved
Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

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

👍 very nice

Copy link
Member

@zelig zelig left a comment

Choose a reason for hiding this comment

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

just minor issues with comments
plus kindly ask to consider my feedback on the earlier PR by @acud in the next iteration

pkg/postage/batchservice/batchservice.go Show resolved Hide resolved
pkg/postage/batchservice/batchservice.go Outdated Show resolved Hide resolved
pkg/postage/batchstore/mock/store.go Outdated Show resolved Hide resolved
@acud acud merged commit 2ba6912 into storage-incentives Jan 13, 2021
@acud acud deleted the feature/postage-batchstore-batchservice branch January 13, 2021 12:02
acud pushed a commit that referenced this pull request Jan 15, 2021
Co-authored-by: zelig <viktor.tron@gmail.com>
acud pushed a commit that referenced this pull request Jan 27, 2021
Co-authored-by: zelig <viktor.tron@gmail.com>
acud pushed a commit that referenced this pull request Feb 1, 2021
Co-authored-by: zelig <viktor.tron@gmail.com>
acud pushed a commit that referenced this pull request Feb 3, 2021
Co-authored-by: zelig <viktor.tron@gmail.com>
acud pushed a commit that referenced this pull request Feb 9, 2021
Co-authored-by: zelig <viktor.tron@gmail.com>
acud added a commit that referenced this pull request Apr 13, 2021
postage: new pkg for postage stamps, uploader stamping (#890)

* postage: new pkg for postage stamps, uploader stamping

* postage: amount->value, blockNumber big.Int-> uint64, stamp only has batch ID, not Batch

* postage: fix godoc and copyright

* postage, swarm:
 - swarm.Stamp as an interface
 - add postage/testing for mock Stamps
 - fix Stamp MarshalBinary to allow nil batch id and signature
 - add StampSize const

* postage: heed review feedback

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

Storage incentives: add stamper putter to api

Postage BatchStore and BatchService (#1070)

Co-authored-by: zelig <viktor.tron@gmail.com>

add normalisedBalance to updater interface (#1108)

make value the normalised balance (#1111)

postage: add event listener (#1099)

Wire up postage stamp syncing (#1114)

localstore, shed: persist stamps (#1116)

add --postage to beeinfra.sh setup

pullsync, pushsync: add postage stamps (#1117)

postage: add create endpoint (#1142)

retrieve erc20 address from postage contract (#1169)

postage: check balance before attempting stamp creation (#1177)

postage: fix bucket depth (#1178)

api: use hex encoding in postage api (#1179)

increase page size (#1182)

postage: handle bucket depth error in api (#1183)

localstore: attach stamp to outgoing chunk (#1192)

update postage stamp contract addresses for new token (#1208)

batchstore: reserve (#1262)

* postage/batchstore: reserve logic

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

stamp support in storage and protocols (#1321)

api: endpoints for stamp issuers (#1535)

retrieval: add stamps (#1552)

localstore reserve logic (#1322)

Co-authored-by: acud <12988138+acud@users.noreply.github.com>
acud added a commit that referenced this pull request Apr 15, 2021
postage: new pkg for postage stamps, uploader stamping (#890)

* postage: new pkg for postage stamps, uploader stamping

* postage: amount->value, blockNumber big.Int-> uint64, stamp only has batch ID, not Batch

* postage: fix godoc and copyright

* postage, swarm:
 - swarm.Stamp as an interface
 - add postage/testing for mock Stamps
 - fix Stamp MarshalBinary to allow nil batch id and signature
 - add StampSize const

* postage: heed review feedback

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

Storage incentives: add stamper putter to api

Postage BatchStore and BatchService (#1070)

Co-authored-by: zelig <viktor.tron@gmail.com>

add normalisedBalance to updater interface (#1108)

make value the normalised balance (#1111)

postage: add event listener (#1099)

Wire up postage stamp syncing (#1114)

localstore, shed: persist stamps (#1116)

add --postage to beeinfra.sh setup

pullsync, pushsync: add postage stamps (#1117)

postage: add create endpoint (#1142)

retrieve erc20 address from postage contract (#1169)

postage: check balance before attempting stamp creation (#1177)

postage: fix bucket depth (#1178)

api: use hex encoding in postage api (#1179)

increase page size (#1182)

postage: handle bucket depth error in api (#1183)

localstore: attach stamp to outgoing chunk (#1192)

update postage stamp contract addresses for new token (#1208)

batchstore: reserve (#1262)

* postage/batchstore: reserve logic

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

stamp support in storage and protocols (#1321)

api: endpoints for stamp issuers (#1535)

retrieval: add stamps (#1552)

localstore reserve logic (#1322)

Co-authored-by: acud <12988138+acud@users.noreply.github.com>
acud added a commit that referenced this pull request Apr 26, 2021
postage: new pkg for postage stamps, uploader stamping (#890)

* postage: new pkg for postage stamps, uploader stamping

* postage: amount->value, blockNumber big.Int-> uint64, stamp only has batch ID, not Batch

* postage: fix godoc and copyright

* postage, swarm:
 - swarm.Stamp as an interface
 - add postage/testing for mock Stamps
 - fix Stamp MarshalBinary to allow nil batch id and signature
 - add StampSize const

* postage: heed review feedback

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

Storage incentives: add stamper putter to api

Postage BatchStore and BatchService (#1070)

Co-authored-by: zelig <viktor.tron@gmail.com>

add normalisedBalance to updater interface (#1108)

make value the normalised balance (#1111)

postage: add event listener (#1099)

Wire up postage stamp syncing (#1114)

localstore, shed: persist stamps (#1116)

add --postage to beeinfra.sh setup

pullsync, pushsync: add postage stamps (#1117)

postage: add create endpoint (#1142)

retrieve erc20 address from postage contract (#1169)

postage: check balance before attempting stamp creation (#1177)

postage: fix bucket depth (#1178)

api: use hex encoding in postage api (#1179)

increase page size (#1182)

postage: handle bucket depth error in api (#1183)

localstore: attach stamp to outgoing chunk (#1192)

update postage stamp contract addresses for new token (#1208)

batchstore: reserve (#1262)

* postage/batchstore: reserve logic

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

stamp support in storage and protocols (#1321)

api: endpoints for stamp issuers (#1535)

retrieval: add stamps (#1552)

localstore reserve logic (#1322)

Co-authored-by: acud <12988138+acud@users.noreply.github.com>
acud added a commit that referenced this pull request Apr 27, 2021
postage: new pkg for postage stamps, uploader stamping (#890)

* postage: new pkg for postage stamps, uploader stamping

* postage: amount->value, blockNumber big.Int-> uint64, stamp only has batch ID, not Batch

* postage: fix godoc and copyright

* postage, swarm:
 - swarm.Stamp as an interface
 - add postage/testing for mock Stamps
 - fix Stamp MarshalBinary to allow nil batch id and signature
 - add StampSize const

* postage: heed review feedback

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

Storage incentives: add stamper putter to api

Postage BatchStore and BatchService (#1070)

Co-authored-by: zelig <viktor.tron@gmail.com>

add normalisedBalance to updater interface (#1108)

make value the normalised balance (#1111)

postage: add event listener (#1099)

Wire up postage stamp syncing (#1114)

localstore, shed: persist stamps (#1116)

add --postage to beeinfra.sh setup

pullsync, pushsync: add postage stamps (#1117)

postage: add create endpoint (#1142)

retrieve erc20 address from postage contract (#1169)

postage: check balance before attempting stamp creation (#1177)

postage: fix bucket depth (#1178)

api: use hex encoding in postage api (#1179)

increase page size (#1182)

postage: handle bucket depth error in api (#1183)

localstore: attach stamp to outgoing chunk (#1192)

update postage stamp contract addresses for new token (#1208)

batchstore: reserve (#1262)

* postage/batchstore: reserve logic

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

stamp support in storage and protocols (#1321)

api: endpoints for stamp issuers (#1535)

retrieval: add stamps (#1552)

localstore reserve logic (#1322)

Co-authored-by: acud <12988138+acud@users.noreply.github.com>
acud added a commit that referenced this pull request Apr 27, 2021
postage: new pkg for postage stamps, uploader stamping (#890)

* postage: new pkg for postage stamps, uploader stamping

* postage: amount->value, blockNumber big.Int-> uint64, stamp only has batch ID, not Batch

* postage: fix godoc and copyright

* postage, swarm:
 - swarm.Stamp as an interface
 - add postage/testing for mock Stamps
 - fix Stamp MarshalBinary to allow nil batch id and signature
 - add StampSize const

* postage: heed review feedback

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

Storage incentives: add stamper putter to api

Postage BatchStore and BatchService (#1070)

Co-authored-by: zelig <viktor.tron@gmail.com>

add normalisedBalance to updater interface (#1108)

make value the normalised balance (#1111)

postage: add event listener (#1099)

Wire up postage stamp syncing (#1114)

localstore, shed: persist stamps (#1116)

add --postage to beeinfra.sh setup

pullsync, pushsync: add postage stamps (#1117)

postage: add create endpoint (#1142)

retrieve erc20 address from postage contract (#1169)

postage: check balance before attempting stamp creation (#1177)

postage: fix bucket depth (#1178)

api: use hex encoding in postage api (#1179)

increase page size (#1182)

postage: handle bucket depth error in api (#1183)

localstore: attach stamp to outgoing chunk (#1192)

update postage stamp contract addresses for new token (#1208)

batchstore: reserve (#1262)

* postage/batchstore: reserve logic

Co-authored-by: acud <12988138+acud@users.noreply.github.com>

stamp support in storage and protocols (#1321)

api: endpoints for stamp issuers (#1535)

retrieval: add stamps (#1552)

localstore reserve logic (#1322)

Co-authored-by: acud <12988138+acud@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants