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

Act merge test2 #61

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4064d14
feat: add act.go with TODOs
Feb 19, 2024
3747c33
Diffie-Hellman (#3)
ferencsarai Mar 13, 2024
4aa8a54
Acces Logic (#8)
aranyia Mar 13, 2024
21d782a
Added context & details to use cases (#6)
aranyia Mar 13, 2024
073fe2f
Add grantee management (#10)
Kexort Mar 14, 2024
a2c39af
(refactor): from `Get` to `Lookup` to improve clarity and consistency…
ferencsarai Mar 19, 2024
bc5326c
Act params rename doc (#14)
ferencsarai Mar 19, 2024
67e826a
Move and refactor ACT diffieHellman to Session. Add Key and NewFromKe…
bosi95 Mar 19, 2024
087bff6
Act swarm address (#15)
ferencsarai Mar 19, 2024
bee534c
(rename): defaultAct to inMemoryAct (#17)
ferencsarai Mar 19, 2024
fb7562a
(refactor): Update controller_test.go to use NewInMemoryAct, modify S…
ferencsarai Mar 20, 2024
bccfacc
Act access logic merge (#19)
rolandlor Mar 21, 2024
a56c526
Act kvs merge (#22)
ferencsarai Mar 22, 2024
9c5c959
Session refactor (#24)
bosi95 Mar 26, 2024
a5151ae
Access logic refactor (#25)
rolandlor Mar 26, 2024
2e843ea
(refactor:) PR comments (#23)
ferencsarai Mar 27, 2024
98a2d5f
Add referenced mock kvs (#26)
Kexort Mar 28, 2024
a549d84
Act kvs test (#27)
ferencsarai Mar 28, 2024
422cb20
Small refactor + al test (#28)
Kexort Apr 2, 2024
330fec8
Persist grantee list on swarm (#30)
bosi95 Apr 3, 2024
58a8915
Update package imports to use the v2 version of the modules (#33)
ferencsarai Apr 4, 2024
ce408ac
chore(mantaray): merge mantaray fix for rebase
LevilkTheReal Apr 9, 2024
94b69e4
Dynamicaccess service for ACT (#35)
bosi95 Apr 19, 2024
37fbb68
Act refactor api and ctrl (#36)
bosi95 Apr 19, 2024
29a5954
ACT grantee management (#37)
Kexort May 13, 2024
eb74fcf
Start refactoring for new linter rules (#39)
kopi-solarpunk May 16, 2024
4d69d8d
refactor(act): typos & docs (#40)
aranyia May 16, 2024
afccdbd
refactor(act): naming and fix remaining PR comments (#42)
bosi95 May 16, 2024
c0fe597
Refactor accesslogic.AddGrantee and parallelize tests (#43)
bosi95 May 17, 2024
b0dba7e
docs(act): add act api to openapi (#44)
aranyia May 22, 2024
5b19d0e
refactor(act): chunk download and granteelist handling (#46)
bosi95 May 23, 2024
3a1ff2b
refactor(act): controller logic (#47)
bosi95 May 24, 2024
09a876b
test(act): controller add, revoke and get with history + fix typos (#48)
bosi95 May 29, 2024
d1ea594
refactor(act): fix pr comments (#50)
bosi95 Jun 6, 2024
bd7ac4e
chore(act): merged api changes
aranyia Jun 7, 2024
b5130ab
chore(act): test master merge as merge commit (#60)
aranyia Jun 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cmd/bee/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethersphere/bee/v2"
"github.com/ethersphere/bee/v2/pkg/accesscontrol"
chaincfg "github.com/ethersphere/bee/v2/pkg/config"
"github.com/ethersphere/bee/v2/pkg/crypto"
"github.com/ethersphere/bee/v2/pkg/crypto/clef"
Expand Down Expand Up @@ -287,7 +288,7 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo
neighborhoodSuggester = c.config.GetString(optionNameNeighborhoodSuggester)
}

b, err := node.NewBee(ctx, c.config.GetString(optionNameP2PAddr), signerConfig.publicKey, signerConfig.signer, networkID, logger, signerConfig.libp2pPrivateKey, signerConfig.pssPrivateKey, &node.Options{
b, err := node.NewBee(ctx, c.config.GetString(optionNameP2PAddr), signerConfig.publicKey, signerConfig.signer, networkID, logger, signerConfig.libp2pPrivateKey, signerConfig.pssPrivateKey, signerConfig.session, &node.Options{
DataDir: c.config.GetString(optionNameDataDir),
CacheCapacity: c.config.GetUint64(optionNameCacheCapacity),
DBOpenFilesLimit: c.config.GetUint64(optionNameDBOpenFilesLimit),
Expand Down Expand Up @@ -363,6 +364,7 @@ type signerConfig struct {
publicKey *ecdsa.PublicKey
libp2pPrivateKey *ecdsa.PrivateKey
pssPrivateKey *ecdsa.PrivateKey
session accesscontrol.Session
}

func waitForClef(logger log.Logger, maxRetries uint64, endpoint string) (externalSigner *external.ExternalSigner, err error) {
Expand Down Expand Up @@ -393,6 +395,7 @@ func (c *command) configureSigner(cmd *cobra.Command, logger log.Logger) (config
var signer crypto.Signer
var password string
var publicKey *ecdsa.PublicKey
var session accesscontrol.Session
if p := c.config.GetString(optionNamePassword); p != "" {
password = p
} else if pf := c.config.GetString(optionNamePasswordFile); pf != "" {
Expand Down Expand Up @@ -465,6 +468,7 @@ func (c *command) configureSigner(cmd *cobra.Command, logger log.Logger) (config
}
signer = crypto.NewDefaultSigner(swarmPrivateKey)
publicKey = &swarmPrivateKey.PublicKey
session = accesscontrol.NewDefaultSession(swarmPrivateKey)
}

logger.Info("swarm public key", "public_key", hex.EncodeToString(crypto.EncodeSecp256k1PublicKey(publicKey)))
Expand Down Expand Up @@ -503,6 +507,7 @@ func (c *command) configureSigner(cmd *cobra.Command, logger log.Logger) (config
publicKey: publicKey,
libp2pPrivateKey: libp2pPrivateKey,
pssPrivateKey: pssPrivateKey,
session: session,
}, nil
}

Expand Down
36 changes: 36 additions & 0 deletions openapi/Swarm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ paths:
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmRedundancyStrategyParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmRedundancyFallbackModeParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmChunkRetrievalTimeoutParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActTimestamp"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActPublisher"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
responses:
"200":
description: Retrieved content specified by reference
Expand All @@ -132,6 +135,9 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress"
required: true
description: Swarm address of chunk
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActTimestamp"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActPublisher"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
responses:
"200":
description: Chunk exists
Expand All @@ -150,6 +156,8 @@ paths:
parameters:
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmAct"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
requestBody:
description: Chunk binary data that has to have at least 8 bytes.
content:
Expand All @@ -165,6 +173,8 @@ paths:
description: Tag UID if it was passed to the request `swarm-tag` header.
schema:
$ref: "SwarmCommon.yaml#/components/schemas/Uid"
"swarm-act-history-address":
$ref: "SwarmCommon.yaml#/components/headers/SwarmActHistoryAddress"
content:
application/json:
schema:
Expand Down Expand Up @@ -221,6 +231,8 @@ paths:
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmDeferredUpload"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmRedundancyLevelParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmAct"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
requestBody:
content:
multipart/form-data:
Expand All @@ -247,6 +259,8 @@ paths:
$ref: "SwarmCommon.yaml#/components/headers/SwarmTag"
"etag":
$ref: "SwarmCommon.yaml#/components/headers/ETag"
"swarm-act-history-address":
$ref: "SwarmCommon.yaml#/components/headers/SwarmActHistoryAddress"
content:
application/json:
schema:
Expand Down Expand Up @@ -276,6 +290,9 @@ paths:
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmRedundancyStrategyParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmRedundancyFallbackModeParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmChunkRetrievalTimeoutParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActTimestamp"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActPublisher"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
responses:
"200":
description: Ok
Expand Down Expand Up @@ -305,6 +322,9 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress"
required: true
description: Swarm address of chunk
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActTimestamp"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActPublisher"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
responses:
"200":
description: Chunk exists
Expand Down Expand Up @@ -691,6 +711,8 @@ paths:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
name: swarm-postage-batch-id
required: true
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmAct"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
requestBody:
required: true
description: The SOC binary data is composed of the span (8 bytes) and the at most 4KB payload.
Expand All @@ -706,6 +728,9 @@ paths:
application/json:
schema:
$ref: "SwarmCommon.yaml#/components/schemas/ReferenceResponse"
headers:
"swarm-act-history-address":
$ref: "SwarmCommon.yaml#/components/headers/SwarmActHistoryAddress"
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
"401":
Expand Down Expand Up @@ -743,13 +768,18 @@ paths:
description: "Feed indexing scheme (default: sequence)"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmAct"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "SwarmCommon.yaml#/components/schemas/ReferenceResponse"
headers:
"swarm-act-history-address":
$ref: "SwarmCommon.yaml#/components/headers/SwarmActHistoryAddress"
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
"401":
Expand Down Expand Up @@ -1084,6 +1114,9 @@ paths:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmCache"
name: swarm-cache
required: false
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActTimestamp"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActPublisher"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
responses:
"200":
description: Retrieved chunk content
Expand Down Expand Up @@ -1111,6 +1144,9 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress"
required: true
description: Swarm address of chunk
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActTimestamp"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActPublisher"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
responses:
"200":
description: Chunk exists
Expand Down
72 changes: 71 additions & 1 deletion openapi/SwarmCommon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,36 @@ components:
ghostBalance:
$ref: "#/components/schemas/BigInt"

ActGranteesCreateRequest:
type: object
properties:
grantees:
type: array
items:
$ref: "#/components/schemas/PublicKey"

ActGranteesPatchRequest:
type: object
properties:
add:
type: array
items:
$ref: "#/components/schemas/PublicKey"
description: List of grantees to add
revoke:
type: array
items:
$ref: "#/components/schemas/PublicKey"
description: List of grantees to revoke future access from

ActGranteesOperationResponse:
type: object
properties:
ref:
$ref: "#/components/schemas/SwarmEncryptedReference"
historyref:
$ref: "#/components/schemas/SwarmEncryptedReference"

Balance:
type: object
properties:
Expand Down Expand Up @@ -849,7 +879,7 @@ components:
reserveSize:
type: integer
reserveSizeWithinRadius:
type: interger
type: integer
pullsyncRate:
type: number
storageRadius:
Expand Down Expand Up @@ -973,6 +1003,12 @@ components:
schema:
$ref: "#/components/schemas/HexString"

SwarmActHistoryAddress:
description: "Swarm address reference to the new ACT history entry"
schema:
$ref: "#/components/schemas/SwarmAddress"
required: false

ETag:
description: |
The RFC7232 ETag header field in a response provides the current entity-
Expand Down Expand Up @@ -1133,6 +1169,40 @@ components:
required: false
description: "Determines if the download data should be cached on the node. By default the download will be cached"

SwarmAct:
in: header
name: swarm-act
schema:
type: boolean
default: "false"
required: false
description: "Determines if the uploaded data should be treated as ACT content"

SwarmActPublisher:
in: header
name: swarm-act-publisher
schema:
$ref: "#/components/schemas/PublicKey"
required: false
description: "ACT content publisher's public key"

SwarmActHistoryAddress:
in: header
name: swarm-act-history-address
schema:
$ref: "#/components/schemas/SwarmAddress"
required: false
description: "ACT history reference address"

SwarmActTimestamp:
in: header
name: swarm-act-timestamp
schema:
type: integer
format: int64
required: false
description: "ACT history Unix timestamp"

responses:
"200":
description: OK.
Expand Down
Loading
Loading