Skip to content

Commit

Permalink
feat: introduce act (#4692)
Browse files Browse the repository at this point in the history
Co-authored-by: Ferenc Sárai <[email protected]>
Co-authored-by: Bálint Ujvári <[email protected]>
Co-authored-by: Ferenc Sárai <[email protected]>
  • Loading branch information
4 people authored Aug 7, 2024
1 parent 6744499 commit 7e45f3e
Show file tree
Hide file tree
Showing 39 changed files with 4,857 additions and 71 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/beekeeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ jobs:
- name: Test redundancy
id: redundancy
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks ci-redundancy
- name: Test act
id: act
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks ci-act; do echo "waiting for act..."; sleep .3; done'
- name: Collect debug artifacts
if: failure()
run: |
Expand All @@ -181,6 +184,7 @@ jobs:
if ${{ steps.retrieval.outcome=='failure' }}; then FAILED=retrieval; fi
if ${{ steps.manifest.outcome=='failure' }}; then FAILED=manifest; fi
if ${{ steps.content-availability.outcome=='failure' }}; then FAILED=content-availability; fi
if ${{ steps.act.outcome=='failure' }}; then FAILED=act; fi
curl -sSf -X POST -H "Content-Type: application/json" -d "{\"text\": \"**${RUN_TYPE}** Beekeeper Error\nBranch: \`${{ github.head_ref }}\`\nUser: @${{ github.event.pull_request.user.login }}\nDebugging artifacts: [click](https://$BUCKET_NAME.$AWS_ENDPOINT/artifacts_$VERTAG.tar.gz)\nStep failed: \`${FAILED}\`\"}" https://beehive.ethswarm.org/hooks/${{ secrets.TUNSHELL_KEY }}
echo "Failed test: ${FAILED}"
- name: Create tunshell session for debug
Expand Down Expand Up @@ -231,4 +235,4 @@ jobs:
token: ${{ secrets.GHA_PAT_BASIC }}
repository: ethersphere/bee-factory
event-type: build-images
client-payload: '{"tag": "latest"}'
client-payload: '{"tag": "latest"}'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ clean:
$(GO) clean
rm -rf dist/

FORCE:
FORCE:
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 @@ -365,6 +366,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 @@ -395,6 +397,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 @@ -467,6 +470,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 @@ -505,6 +509,7 @@ func (c *command) configureSigner(cmd *cobra.Command, logger log.Logger) (config
publicKey: publicKey,
libp2pPrivateKey: libp2pPrivateKey,
pssPrivateKey: pssPrivateKey,
session: session,
}, nil
}

Expand Down
165 changes: 165 additions & 0 deletions openapi/Swarm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,135 @@ servers:
description: Service port provided in bee node config

paths:
"/grantee":
post:
summary: "Create grantee list"
tags:
- ACT
parameters:
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
name: swarm-postage-batch-id
required: true
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter"
name: swarm-tag
required: false
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
name: swarm-pin
required: false
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmDeferredUpload"
name: swarm-deferred-upload
required: false
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
name: swarm-act-history-address
required: false
requestBody:
required: true
content:
application/json:
schema:
$ref: "SwarmCommon.yaml#/components/schemas/ActGranteesCreateRequest"
responses:
"201":
description: Ok
content:
application/json:
schema:
$ref: "SwarmCommon.yaml#/components/schemas/ActGranteesOperationResponse"
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
"500":
$ref: "SwarmCommon.yaml#/components/responses/500"

"/grantee/{reference}":
get:
summary: "Get grantee list"
tags:
- ACT
parameters:
- in: path
name: reference
schema:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmEncryptedReference"
required: true
description: Grantee list reference
responses:
"200":
description: Ok
content:
application/json:
schema:
type: array
items:
$ref: "SwarmCommon.yaml#/components/schemas/PublicKey"
"404":
$ref: "SwarmCommon.yaml#/components/responses/404"
"500":
$ref: "SwarmCommon.yaml#/components/responses/500"
patch:
summary: "Update grantee list"
description: "Add or remove grantees from an existing grantee list"
tags:
- ACT
parameters:
- in: path
name: reference
schema:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmEncryptedReference"
required: true
description: Grantee list reference
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmActHistoryAddress"
name: swarm-act-history-address
required: true
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
name: swarm-postage-batch-id
required: true
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter"
name: swarm-tag
required: false
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
name: swarm-pin
required: false
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmDeferredUpload"
name: swarm-deferred-upload
required: false
requestBody:
required: true
content:
application/json:
schema:
$ref: "SwarmCommon.yaml#/components/schemas/ActGranteesPatchRequest"
responses:
"200":
description: Ok
content:
application/json:
schema:
$ref: "SwarmCommon.yaml#/components/schemas/ActGranteesOperationResponse"
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
"500":
$ref: "SwarmCommon.yaml#/components/responses/500"

"/bytes":
post:
summary: "Upload data"
Expand Down Expand Up @@ -109,6 +238,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 +264,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 @@ -155,6 +290,8 @@ paths:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
required: false
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageStamp"
- $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 @@ -170,6 +307,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 @@ -226,6 +365,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 @@ -252,6 +393,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 @@ -281,6 +424,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 @@ -310,6 +456,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 @@ -697,6 +846,8 @@ paths:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
required: false
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageStamp"
- $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 @@ -712,6 +863,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 @@ -749,13 +903,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 @@ -1090,6 +1249,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 @@ -1117,6 +1279,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
Loading

0 comments on commit 7e45f3e

Please sign in to comment.