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

fix(getter): redundancy getter cleanup #4610

Merged
merged 4 commits into from
Mar 15, 2024
Merged

fix(getter): redundancy getter cleanup #4610

merged 4 commits into from
Mar 15, 2024

Conversation

istae
Copy link
Member

@istae istae commented Mar 8, 2024

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

  1. removed close call
  2. remove ctx in the struct antipattern
  3. inflight requests are canceled when recovery is initialized.
  4. the joiner does not construct a redundancy getter when fallback mode is false and the strategy is none.

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

@@ -63,6 +63,7 @@ import (
//
// nolint:thelper
func TestBzzUploadDownloadWithRedundancy_FLAKY(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

we should fix this test not skip

return errStrategyFailed
}
for range c {
if g.fetchedCnt.Load() >= int32(g.shardCnt) {
Copy link
Member

Choose a reason for hiding this comment

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

what if neither of these conditions are met. this loop then will never terminate... it is possible m can be less than shard+parity and also the fetches started via Get are concurrent and can reach the counts later then checked here

Copy link
Member Author

Choose a reason for hiding this comment

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

every time c returns, it's guaranteed that either fetchedCnt or failedCnt is already incremented (inside fetch) so eventually one of the conditions are met.

if m is less than shard + parity, then a previous run of fetches has already finished and incremented the counters.

Copy link
Member

Choose a reason for hiding this comment

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

think about this once more. Because of the single flight pattern and Get calls interleaving prefetch fetches, there is a decent probability that the loop will not terminate. All you need to imagine is that the shardCnt-th successful fetch is.
I think we should trigger closing the initRecovery channel when we increment the count (in one atomic call)

}()
// when the recovery is triggered, we can terminate any inflight requests.
// we do the extra bool check to not fire an unnecessary goroutine
if waitForRecovery {
Copy link
Member

Choose a reason for hiding this comment

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

there is no need to run this routine for every fetcgh.
creating context and cancel hould be done onky once

Copy link
Member Author

Choose a reason for hiding this comment

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

context is canceled is a separate goroutine when the recovery is initialized...this is how we achieve early termination.
it's safe to call cancel twice in separate goroutines.

Copy link
Member

@zelig zelig Mar 15, 2024

Choose a reason for hiding this comment

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

it does not make sense to wait on 128 parallel routines to do what you can do in one. Create context with cancel in the prefetch fetch function which is cancelled only once. And apply your logic only to the fetch calls initiqted within Get calls.

@istae istae merged commit ef7c97d into master Mar 15, 2024
14 checks passed
@istae istae deleted the fetcher-optimazation branch March 15, 2024 13:44
@zelig zelig mentioned this pull request Mar 24, 2024
@NoahMaizels
Copy link
Contributor

NoahMaizels commented Mar 25, 2024

Last week:

This week:

  • Present new docs content and highlight video guides at SCC
  • Adapt and add doubling and neighborhoods guide to docs
  • Add devops guide to docs
  • 2.0 comms
  • Docs issues backlog catchup time permitting

aranyia added a commit to Solar-Punk-Ltd/bee that referenced this pull request Apr 3, 2024
* fix(stamper): global lock stamper across multiple upload sessions (ethersphere#4578)
* fix: strategy and fetch timeout parsing (ethersphere#4579)
* feat: neighborhood suggester config (ethersphere#4580)
* feat: add codeql.yml (ethersphere#4334)
* feat: add reserveSizeWithinRadius to status protocol (ethersphere#4585)
* fix: missing 200 response (ethersphere#4526)
* feat: pinned reference integrity check API (ethersphere#4573)
* fix(redundancy/getter): wait for recovery and return error (ethersphere#4581)
* fix(pushsync): store the chunk locally when no peers are available fo… (ethersphere#4597)
* fix(redundancy): on by default when downloading (ethersphere#4602)
* fix: add missing openapi spec (ethersphere#4598)
* feat: bzz resource info API (ethersphere#4588)
* fix(redundancy): bzz unit test (ethersphere#4603)
* feat: redundancy ci (ethersphere#4591)
* chore: bump github.com/quic-go/quic-go from 0.38.1 to 0.38.2 (ethersphere#4534)
* feat: split input file to chunks with specified redundancy (ethersphere#4600)
* perf(getter): cancel inflight requests if enough chunks are fetched for recovery (ethersphere#4608)
* fix: store dir error info (ethersphere#4605)
* chore: remove repetitive words (ethersphere#4611)
* fix: use neighborhood suggester only on mainnet (ethersphere#4612)
* feat: alternative withdrawal address (ethersphere#4606)
* fix(seg65) (ethersphere#4604)
* fix(getter): redundancy getter cleanup (ethersphere#4610)
* feat: v2 (ethersphere#4615)
* fix(pin_integrity): changed route and added openapi (ethersphere#4616)
* fix: missing v2 in the makefile and goreleaser (ethersphere#4622)
bosi95 added a commit to Solar-Punk-Ltd/bee that referenced this pull request Apr 19, 2024
* feat: add act.go with TODOs

feat: Add Act interface

feat: Add Marshal, Unmarshal skeleton

feat: Refactor AccessType to iota

feat: Add upload

feat: Rename GenerateAccessControlManifest -> create

feat: Add saltLengthIs32

feat: Add Mrshal, Unmarshal impl

feat: Add Marshal Unmarshal

feat: Remove ManifestEntry json annotations

feat: Modify to public finc/method

feat: Add ErrSaltLength

Add pkg/dynamicaccess

Refactor interfaces and implement default structs

Refactor typo

Refactor History package to use NewHistory() function

Add Act interface and default implementation

Add ACT use cases to act_ucs.md

Add new files and implement interfaces, refactor packeges

Update act_ucs.md

base usecases

Refactor access logic and add mock implementations***

Add DiffieHellman implementation and remove Keystore***

Refactor NewAccessLogic function

Replace encryption.go to pkg/encryption

Refactor packages

Update act_ucs.md

Update act_ucs.md

Update act_ucs.md

Update act_ucs.md

Update act_ucs.md

* Diffie-Hellman (#3)

* Use DiffieHellmanMock

* Adds a comment about Get

* Add support for ECDSA public key in DiffieHellman.SharedSecret function

* Update defaultAct implementation

* Adds pseudo code for Access Logic

* Update default Act creation; Fix basic Act tests

* Refactor access logic to use new ActMock implementation

* feat(history): test mockups wip

* Refactor DiffieHellman implementation

* changes pseudocode for Diffie-Hellmann read

* Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>

* DiffieHellman mock generates a real sherd secret

* Refactor Act

* Adds manifest lookup

* Extend act_test

* Adds unit tests, some values are mocked

* Refactor act mock impl with map[string]map[string]string

* Add check mock implementation for DiffieHellman interface

* Add Load, Store to Act interface. Refactor Act interface

* refactor act, diffieHellman mocks, tests

* Add TestLoadStore function to act_test.go

* Remove unnecessary code in Load function

* Add history mock and History lookup test

* Act refactor

Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>

* Refactor Add method to return Act interface

* Change Get method return type to []byte

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Peter Ott <ottpeter@tuta.io>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>
Co-authored-by: Levente Kiss <levente.kiss@solarpunk.bzz>
Co-authored-by: Roland Seres <roland.seres90@gmail.com>
Co-authored-by: Kexort <kexort@gmail.com>
Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>

* Acces Logic (#8)

* Use DiffieHellmanMock

* Adds a comment about Get

* Add support for ECDSA public key in DiffieHellman.SharedSecret function

* Update defaultAct implementation

* Adds pseudo code for Access Logic

* Update default Act creation; Fix basic Act tests

* Refactor access logic to use new ActMock implementation

* feat(history): test mockups wip

* Refactor DiffieHellman implementation

* changes pseudocode for Diffie-Hellmann read

* Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>

* DiffieHellman mock generates a real sherd secret

* Refactor Act

* Adds manifest lookup

* Extend act_test

* Adds unit tests, some values are mocked

* Refactor act mock impl with map[string]map[string]string

* Add check mock implementation for DiffieHellman interface

* started Add

* changed some sig

* save

* new grantee addition handling

* mod

* changed helper function visibilities

* some mod with grantee

* test mod

* save

* no error in actInit

* Add_New_Grantee_To_Content

* comment

* copied act_test.go

* no compiler errors on our side

* Adds Add_New_Grantee_To_Content and ActInit

* almost complete grantee container

* maybe complete grantee container

* Solves merge conflict

* access-logic-merge

* fix merge issues

* Added context & details to use cases (#6)

ZH ethersphere#106 Added context & details to use cases

* Add grantee management (#10)

* Add grantee management

* Added controller test

* Fix test fixture, refactor accesslogic

* Add UploadHandler

---------

Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>

* (refactor): from `Get` to `Lookup` to improve clarity and consistency. The changes have been made in the `accesslogic.go`, `act.go`, `act_test.go`, `history_test.go`, and `mock/act.go` files. (#13)

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* Act params rename doc (#14)

* (refactor): ACT interface params + add doc comments

* Revert "(refactor): ACT interface params + add doc comments"

This reverts commit ee8da04.

* (refactor): ACT interface params + add doc comments

* (refactor): Add error to ACT interface methods

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* Move and refactor ACT diffieHellman to Session. Add Key and NewFromKeystore functions. (#16)

* Act swarm address (#15)

* (refactor): ACT interface params + add doc comments

* Revert "(refactor): ACT interface params + add doc comments"

This reverts commit ee8da04.

* (refactor): ACT interface params + add doc comments

* (refactor): Add error to ACT interface methods

* Add in-memory storage and implement Store and Load methods

* Move and refactor ACT diffieHellman to Session. Add Key and NewFromKeystore functions.

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>

* (rename): defaultAct to inMemoryAct (#17)

* (refactor): ACT interface params + add doc comments

* Revert "(refactor): ACT interface params + add doc comments"

This reverts commit ee8da04.

* (refactor): ACT interface params + add doc comments

* (refactor): Add error to ACT interface methods

* Add in-memory storage and implement Store and Load methods

* *refactor) Rename defaultAct to inMemroryAct

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* (refactor): Update controller_test.go to use NewInMemoryAct, modify Session.Key to return correct dimensional byte slice (#18)

* (refactor): Update controller_test.go to use NewInMemoryAct, modify Session.Key to return two-dimensional byte slice

* (refactor:) Refactor session Key function to use append instead of index-based assignment

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* Act access logic merge (#19)

* grantee container and access logc tests are passed

* refactored access logic and grantee container

* PR 19 comments resolving

* Refactor

* Refactor

* Act kvs merge (#22)

* grantee container and access logc tests are passed

* refactored access logic and grantee container

* PR 19 comments resolving

* Refactor

* Refactor

* working manifest ACT with basic tests

* (refactor:) Refactor act_test

* (refactor:) Refactor kvs -> kvs.manifest, kvs.memory

* (refactror:) kvs

* refactor kvs contsructors

---------

Co-authored-by: Roland Seres <roland.seres90@gmail.com>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* Session refactor (#24)

* pr comment fix

* add comment to session.NewFromKeystore

* Access logic refactor (#25)

Refactors access logic

---------

Co-authored-by: Peter Ott <peter.ott@solarpunk.buzz>
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>
Co-authored-by: Peter Ott <ottpeter@tuta.io>

* (refactor:) PR comments (#23)

* grantee-refactor

* Dried up code, related to AddPublisher - AddNewGranteeToContent

* Refactor

* removed getEncryptedAccessKey

* Renamed AddGrentees, RemoveGrantees, etc to Add, Remove, etc

* (refactor:) PR comments

* (refactor:) compile check

* removed encrypted_ref, grantee check (validation)

* changed interface

* comments

* some more comments

* refactor kvs and add load and store

* (refactor:) Use ref

* renamed defaultGrantee to granteeList

* removed null encrypted test in  in TestGet_Error

* refactor kvs: pass kvs IF argument instead of storing it

* Refactor according to the result of the workshop

* refactor kvs IF and mock

* fix merge errors and Logic/get_error test

* (test:) Add test for put/get after kvs.Save

---------

Co-authored-by: Roland Seres <roland.seres90@gmail.com>
Co-authored-by: Peter Ott <peter.ott@solarpunk.buzz>
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>
Co-authored-by: Peter Ott <ottpeter@tuta.io>

* Add referenced mock kvs (#26)

* add controller upload test

* compile

* Add test for grantee

* Add Upload test

* Implement controller logic, move grantee management

* Act kvs test (#27)

* (test:) Refactor tests

* (fix:) Save reset counter

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* feat: add history lookup and add

* feat: expose mantaray manifest

* Small refactor + al test (#28)

Adds TestDecryptRefWithGrantee_Success and replaces generateFixPrivateKey with getPrivKey

Co-authored-by: Peter Ott <ottpeter@tuta.io>

* chore: tests + minor fixes

* chore: minor test change

* feat: history with reference

* chore: debugging

* Persist grantee list on swarm (#30)

* Persist grantee list on swarm
* accesslogic refactor
* Refactor grantee list tests

Co-authored-by: Roland Seres <roland.seres90@gmail.com>

* Merging Swarm 2.0 master (#32)

* fix(stamper): global lock stamper across multiple upload sessions (ethersphere#4578)
* fix: strategy and fetch timeout parsing (ethersphere#4579)
* feat: neighborhood suggester config (ethersphere#4580)
* feat: add codeql.yml (ethersphere#4334)
* feat: add reserveSizeWithinRadius to status protocol (ethersphere#4585)
* fix: missing 200 response (ethersphere#4526)
* feat: pinned reference integrity check API (ethersphere#4573)
* fix(redundancy/getter): wait for recovery and return error (ethersphere#4581)
* fix(pushsync): store the chunk locally when no peers are available fo… (ethersphere#4597)
* fix(redundancy): on by default when downloading (ethersphere#4602)
* fix: add missing openapi spec (ethersphere#4598)
* feat: bzz resource info API (ethersphere#4588)
* fix(redundancy): bzz unit test (ethersphere#4603)
* feat: redundancy ci (ethersphere#4591)
* chore: bump github.com/quic-go/quic-go from 0.38.1 to 0.38.2 (ethersphere#4534)
* feat: split input file to chunks with specified redundancy (ethersphere#4600)
* perf(getter): cancel inflight requests if enough chunks are fetched for recovery (ethersphere#4608)
* fix: store dir error info (ethersphere#4605)
* chore: remove repetitive words (ethersphere#4611)
* fix: use neighborhood suggester only on mainnet (ethersphere#4612)
* feat: alternative withdrawal address (ethersphere#4606)
* fix(seg65) (ethersphere#4604)
* fix(getter): redundancy getter cleanup (ethersphere#4610)
* feat: v2 (ethersphere#4615)
* fix(pin_integrity): changed route and added openapi (ethersphere#4616)
* fix: missing v2 in the makefile and goreleaser (ethersphere#4622)

* chore: package update

* Update package imports to use the v2 version of the modules (#33)

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* fix walkfn with key sort

* feat: new option to walk nodes of mantaray in sequence

* feat: add latest timestamp check

* chore: uncomment wip stuff

* chore: requested changes

* test: fix to latest adjustment

* Add ctrl logic

* Add dac service

* Continue add ACT handler

* chore: use ZeroAddress

* chore: make var name more general

* connect api test with dac service

* refactor ctrl based on history v2

* Fix: controller upload download flow + basic tests

* hacked mock dac service for simple upload and download

* Insert act uploadhandler into /bzz endpoint and remove uphandler

* Refactor controller and api; enrypt and rLevel passed on during up/download

* Connect Get,Head,Post endpoints with ACT

* Add: act to devnode

* devnode: close dac during shutdown

* pass decrypted ref in r.ctx

* set address ctx as swarm address

* refactor: call actEncrpytionHandler in every endpoint

* typo and comment fix in dynamicaccess

* Add: mock dynamicaccess service and api tests

* Add: TestDacEachEndpointWithAct; fixed some review comments

* Add ACT head test for endpoints

* CHG: first encrypt via ACT then upload normal reference

* FIX: apiservice.dac nil error

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
Co-authored-by: Peter Ott <ottpeter@tuta.io>
Co-authored-by: Levente Kiss <levente.kiss@solarpunk.bzz>
Co-authored-by: Roland Seres <roland.seres90@gmail.com>
Co-authored-by: Kexort <kexort@gmail.com>
Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>
Co-authored-by: András Arányi <aranyia@users.noreply.github.com>
Co-authored-by: rolandlor <33499567+rolandlor@users.noreply.github.com>
Co-authored-by: Peter Ott <peter.ott@solarpunk.buzz>
aranyia added a commit to Solar-Punk-Ltd/bee that referenced this pull request May 17, 2024
* feat: add act.go with TODOs

feat: Add Act interface

feat: Add Marshal, Unmarshal skeleton

feat: Refactor AccessType to iota

feat: Add upload

feat: Rename GenerateAccessControlManifest -> create

feat: Add saltLengthIs32

feat: Add Mrshal, Unmarshal impl

feat: Add Marshal Unmarshal

feat: Remove ManifestEntry json annotations

feat: Modify to public finc/method

feat: Add ErrSaltLength

Add pkg/dynamicaccess

Refactor interfaces and implement default structs

Refactor typo

Refactor History package to use NewHistory() function

Add Act interface and default implementation

Add ACT use cases to act_ucs.md

Add new files and implement interfaces, refactor packeges

Update act_ucs.md

base usecases

Refactor access logic and add mock implementations***

Add DiffieHellman implementation and remove Keystore***

Refactor NewAccessLogic function

Replace encryption.go to pkg/encryption

Refactor packages

Update act_ucs.md

Update act_ucs.md

Update act_ucs.md

Update act_ucs.md

Update act_ucs.md

* Diffie-Hellman (#3)

* Use DiffieHellmanMock

* Adds a comment about Get

* Add support for ECDSA public key in DiffieHellman.SharedSecret function

* Update defaultAct implementation

* Adds pseudo code for Access Logic

* Update default Act creation; Fix basic Act tests

* Refactor access logic to use new ActMock implementation

* feat(history): test mockups wip

* Refactor DiffieHellman implementation

* changes pseudocode for Diffie-Hellmann read

* Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>

* DiffieHellman mock generates a real sherd secret

* Refactor Act

* Adds manifest lookup

* Extend act_test

* Adds unit tests, some values are mocked

* Refactor act mock impl with map[string]map[string]string

* Add check mock implementation for DiffieHellman interface

* Add Load, Store to Act interface. Refactor Act interface

* refactor act, diffieHellman mocks, tests

* Add TestLoadStore function to act_test.go

* Remove unnecessary code in Load function

* Add history mock and History lookup test

* Act refactor

Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>

* Refactor Add method to return Act interface

* Change Get method return type to []byte

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Peter Ott <ottpeter@tuta.io>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>
Co-authored-by: Levente Kiss <levente.kiss@solarpunk.bzz>
Co-authored-by: Roland Seres <roland.seres90@gmail.com>
Co-authored-by: Kexort <kexort@gmail.com>
Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>

* Acces Logic (#8)

* Use DiffieHellmanMock

* Adds a comment about Get

* Add support for ECDSA public key in DiffieHellman.SharedSecret function

* Update defaultAct implementation

* Adds pseudo code for Access Logic

* Update default Act creation; Fix basic Act tests

* Refactor access logic to use new ActMock implementation

* feat(history): test mockups wip

* Refactor DiffieHellman implementation

* changes pseudocode for Diffie-Hellmann read

* Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>

* DiffieHellman mock generates a real sherd secret

* Refactor Act

* Adds manifest lookup

* Extend act_test

* Adds unit tests, some values are mocked

* Refactor act mock impl with map[string]map[string]string

* Add check mock implementation for DiffieHellman interface

* started Add

* changed some sig

* save

* new grantee addition handling

* mod

* changed helper function visibilities

* some mod with grantee

* test mod

* save

* no error in actInit

* Add_New_Grantee_To_Content

* comment

* copied act_test.go

* no compiler errors on our side

* Adds Add_New_Grantee_To_Content and ActInit

* almost complete grantee container

* maybe complete grantee container

* Solves merge conflict

* access-logic-merge

* fix merge issues

* Added context & details to use cases (#6)

ZH ethersphere#106 Added context & details to use cases

* Add grantee management (#10)

* Add grantee management

* Added controller test

* Fix test fixture, refactor accesslogic

* Add UploadHandler

---------

Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>

* (refactor): from `Get` to `Lookup` to improve clarity and consistency. The changes have been made in the `accesslogic.go`, `act.go`, `act_test.go`, `history_test.go`, and `mock/act.go` files. (#13)

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* Act params rename doc (#14)

* (refactor): ACT interface params + add doc comments

* Revert "(refactor): ACT interface params + add doc comments"

This reverts commit ee8da04.

* (refactor): ACT interface params + add doc comments

* (refactor): Add error to ACT interface methods

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* Move and refactor ACT diffieHellman to Session. Add Key and NewFromKeystore functions. (#16)

* Act swarm address (#15)

* (refactor): ACT interface params + add doc comments

* Revert "(refactor): ACT interface params + add doc comments"

This reverts commit ee8da04.

* (refactor): ACT interface params + add doc comments

* (refactor): Add error to ACT interface methods

* Add in-memory storage and implement Store and Load methods

* Move and refactor ACT diffieHellman to Session. Add Key and NewFromKeystore functions.

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>

* (rename): defaultAct to inMemoryAct (#17)

* (refactor): ACT interface params + add doc comments

* Revert "(refactor): ACT interface params + add doc comments"

This reverts commit ee8da04.

* (refactor): ACT interface params + add doc comments

* (refactor): Add error to ACT interface methods

* Add in-memory storage and implement Store and Load methods

* *refactor) Rename defaultAct to inMemroryAct

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* (refactor): Update controller_test.go to use NewInMemoryAct, modify Session.Key to return correct dimensional byte slice (#18)

* (refactor): Update controller_test.go to use NewInMemoryAct, modify Session.Key to return two-dimensional byte slice

* (refactor:) Refactor session Key function to use append instead of index-based assignment

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* Act access logic merge (#19)

* grantee container and access logc tests are passed

* refactored access logic and grantee container

* PR 19 comments resolving

* Refactor

* Refactor

* Act kvs merge (#22)

* grantee container and access logc tests are passed

* refactored access logic and grantee container

* PR 19 comments resolving

* Refactor

* Refactor

* working manifest ACT with basic tests

* (refactor:) Refactor act_test

* (refactor:) Refactor kvs -> kvs.manifest, kvs.memory

* (refactror:) kvs

* refactor kvs contsructors

---------

Co-authored-by: Roland Seres <roland.seres90@gmail.com>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* Session refactor (#24)

* pr comment fix

* add comment to session.NewFromKeystore

* Access logic refactor (#25)

Refactors access logic

---------

Co-authored-by: Peter Ott <peter.ott@solarpunk.buzz>
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>
Co-authored-by: Peter Ott <ottpeter@tuta.io>

* (refactor:) PR comments (#23)

* grantee-refactor

* Dried up code, related to AddPublisher - AddNewGranteeToContent

* Refactor

* removed getEncryptedAccessKey

* Renamed AddGrentees, RemoveGrantees, etc to Add, Remove, etc

* (refactor:) PR comments

* (refactor:) compile check

* removed encrypted_ref, grantee check (validation)

* changed interface

* comments

* some more comments

* refactor kvs and add load and store

* (refactor:) Use ref

* renamed defaultGrantee to granteeList

* removed null encrypted test in  in TestGet_Error

* refactor kvs: pass kvs IF argument instead of storing it

* Refactor according to the result of the workshop

* refactor kvs IF and mock

* fix merge errors and Logic/get_error test

* (test:) Add test for put/get after kvs.Save

---------

Co-authored-by: Roland Seres <roland.seres90@gmail.com>
Co-authored-by: Peter Ott <peter.ott@solarpunk.buzz>
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Bálint Ujvári <balint.ujvari@solarpunk.buzz>
Co-authored-by: Peter Ott <ottpeter@tuta.io>

* Add referenced mock kvs (#26)

* add controller upload test

* compile

* Add test for grantee

* Add Upload test

* Implement controller logic, move grantee management

* Act kvs test (#27)

* (test:) Refactor tests

* (fix:) Save reset counter

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* feat: add history lookup and add

* feat: expose mantaray manifest

* Small refactor + al test (#28)

Adds TestDecryptRefWithGrantee_Success and replaces generateFixPrivateKey with getPrivKey

Co-authored-by: Peter Ott <ottpeter@tuta.io>

* chore: tests + minor fixes

* chore: minor test change

* feat: history with reference

* chore: debugging

* Persist grantee list on swarm (#30)

* Persist grantee list on swarm
* accesslogic refactor
* Refactor grantee list tests

Co-authored-by: Roland Seres <roland.seres90@gmail.com>

* Merging Swarm 2.0 master (#32)

* fix(stamper): global lock stamper across multiple upload sessions (ethersphere#4578)
* fix: strategy and fetch timeout parsing (ethersphere#4579)
* feat: neighborhood suggester config (ethersphere#4580)
* feat: add codeql.yml (ethersphere#4334)
* feat: add reserveSizeWithinRadius to status protocol (ethersphere#4585)
* fix: missing 200 response (ethersphere#4526)
* feat: pinned reference integrity check API (ethersphere#4573)
* fix(redundancy/getter): wait for recovery and return error (ethersphere#4581)
* fix(pushsync): store the chunk locally when no peers are available fo… (ethersphere#4597)
* fix(redundancy): on by default when downloading (ethersphere#4602)
* fix: add missing openapi spec (ethersphere#4598)
* feat: bzz resource info API (ethersphere#4588)
* fix(redundancy): bzz unit test (ethersphere#4603)
* feat: redundancy ci (ethersphere#4591)
* chore: bump github.com/quic-go/quic-go from 0.38.1 to 0.38.2 (ethersphere#4534)
* feat: split input file to chunks with specified redundancy (ethersphere#4600)
* perf(getter): cancel inflight requests if enough chunks are fetched for recovery (ethersphere#4608)
* fix: store dir error info (ethersphere#4605)
* chore: remove repetitive words (ethersphere#4611)
* fix: use neighborhood suggester only on mainnet (ethersphere#4612)
* feat: alternative withdrawal address (ethersphere#4606)
* fix(seg65) (ethersphere#4604)
* fix(getter): redundancy getter cleanup (ethersphere#4610)
* feat: v2 (ethersphere#4615)
* fix(pin_integrity): changed route and added openapi (ethersphere#4616)
* fix: missing v2 in the makefile and goreleaser (ethersphere#4622)

* chore: package update

* Update package imports to use the v2 version of the modules (#33)

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>

* fix walkfn with key sort

* feat: new option to walk nodes of mantaray in sequence

* feat: add latest timestamp check

* chore: uncomment wip stuff

* chore: requested changes

* test: fix to latest adjustment

* Add ctrl logic

* Add dac service

* Continue add ACT handler

* chore: use ZeroAddress

* chore: make var name more general

* connect api test with dac service

* refactor ctrl based on history v2

* Fix: controller upload download flow + basic tests

* hacked mock dac service for simple upload and download

* Insert act uploadhandler into /bzz endpoint and remove uphandler

* Refactor controller and api; enrypt and rLevel passed on during up/download

* Connect Get,Head,Post endpoints with ACT

* Add: act to devnode

* devnode: close dac during shutdown

* pass decrypted ref in r.ctx

* set address ctx as swarm address

* refactor: call actEncrpytionHandler in every endpoint

* typo and comment fix in dynamicaccess

* Add: mock dynamicaccess service and api tests

* Add: TestDacEachEndpointWithAct; fixed some review comments

* Add ACT head test for endpoints

* CHG: first encrypt via ACT then upload normal reference

* FIX: apiservice.dac nil error

---------

Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
Co-authored-by: Peter Ott <ottpeter@tuta.io>
Co-authored-by: Levente Kiss <levente.kiss@solarpunk.bzz>
Co-authored-by: Roland Seres <roland.seres90@gmail.com>
Co-authored-by: Kexort <kexort@gmail.com>
Co-authored-by: Bálint Ujvári <bosi95@users.noreply.github.com>
Co-authored-by: András Arányi <aranyia@users.noreply.github.com>
Co-authored-by: rolandlor <33499567+rolandlor@users.noreply.github.com>
Co-authored-by: Peter Ott <peter.ott@solarpunk.buzz>
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

5 participants