Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/gsoc-subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
nugaon committed Oct 29, 2024
2 parents 68f97ce + 243bd3c commit a50e693
Show file tree
Hide file tree
Showing 17 changed files with 771 additions and 167 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/beekeeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
REPLICA: 3
RUN_TYPE: "PR RUN"
SETUP_CONTRACT_IMAGE: "ethersphere/bee-localchain"
SETUP_CONTRACT_IMAGE_TAG: "0.9.2-rc1"
SETUP_CONTRACT_IMAGE_TAG: "0.9.2-rc5"
BEELOCAL_BRANCH: "main"
BEEKEEPER_BRANCH: "master"
BEEKEEPER_METRICS_ENABLED: false
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/coreos/go-semver v0.3.0
github.com/ethereum/go-ethereum v1.14.3
github.com/ethersphere/go-price-oracle-abi v0.2.0
github.com/ethersphere/go-storage-incentives-abi v0.9.2-rc1
github.com/ethersphere/go-storage-incentives-abi v0.9.2-rc5
github.com/ethersphere/go-sw3-abi v0.6.5
github.com/ethersphere/langos v1.0.0
github.com/go-playground/validator/v10 v10.11.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ github.com/ethereum/go-ethereum v1.14.3 h1:5zvnAqLtnCZrU9uod1JCvHWJbPMURzYFHfc2e
github.com/ethereum/go-ethereum v1.14.3/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8=
github.com/ethersphere/go-price-oracle-abi v0.2.0 h1:wtIcYLgNZHY4BjYwJCnu93SvJdVAZVvBaKinspyyHvQ=
github.com/ethersphere/go-price-oracle-abi v0.2.0/go.mod h1:sI/Qj4/zJ23/b1enzwMMv0/hLTpPNVNacEwCWjo6yBk=
github.com/ethersphere/go-storage-incentives-abi v0.9.2-rc1 h1:Cf3LFlz87FqlTqcuN4q4Hry4iUaAbbroaFxpCgHVhtY=
github.com/ethersphere/go-storage-incentives-abi v0.9.2-rc1/go.mod h1:SXvJVtM4sEsaSKD0jc1ClpDLw8ErPoROZDme4Wrc/Nc=
github.com/ethersphere/go-storage-incentives-abi v0.9.2-rc5 h1:orVNqoeAQTavuKmYSJYJF+nfy4wHBL9ZzS3vV1z2K9o=
github.com/ethersphere/go-storage-incentives-abi v0.9.2-rc5/go.mod h1:SXvJVtM4sEsaSKD0jc1ClpDLw8ErPoROZDme4Wrc/Nc=
github.com/ethersphere/go-sw3-abi v0.6.5 h1:M5dcIe1zQYvGpY2K07UNkNU9Obc4U+A1fz68Ho/Q+XE=
github.com/ethersphere/go-sw3-abi v0.6.5/go.mod h1:BmpsvJ8idQZdYEtWnvxA8POYQ8Rl/NhyCdF0zLMOOJU=
github.com/ethersphere/langos v1.0.0 h1:NBtNKzXTTRSue95uOlzPN4py7Aofs0xWPzyj4AI1Vcc=
Expand Down
1 change: 1 addition & 0 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ type Service struct {
ethereumAddress common.Address
chequebookEnabled bool
swapEnabled bool
fullAPIEnabled bool

topologyDriver topology.Driver
p2p p2p.DebugService
Expand Down
23 changes: 13 additions & 10 deletions pkg/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ type testServerOptions struct {
NodeStatus *status.Service
PinIntegrity api.PinIntegrity
WhitelistedAddr string
FullAPIDisabled bool
ChequebookDisabled bool
SwapDisabled bool
}

func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket.Conn, string, *chanStorer) {
Expand Down Expand Up @@ -181,7 +184,7 @@ func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket.
erc20 := erc20mock.New(o.Erc20Opts...)
backend := backendmock.New(o.BackendOpts...)

var extraOpts = api.ExtraOptions{
extraOpts := api.ExtraOptions{
TopologyDriver: topologyDriver,
Accounting: acc,
Pseudosettle: recipient,
Expand Down Expand Up @@ -210,7 +213,7 @@ func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket.
o.BeeMode = api.FullMode
}

s := api.New(o.PublicKey, o.PSSPublicKey, o.EthereumAddress, []string{o.WhitelistedAddr}, o.Logger, transaction, o.BatchStore, o.BeeMode, true, true, backend, o.CORSAllowedOrigins, inmemstore.New())
s := api.New(o.PublicKey, o.PSSPublicKey, o.EthereumAddress, []string{o.WhitelistedAddr}, o.Logger, transaction, o.BatchStore, o.BeeMode, !o.ChequebookDisabled, !o.SwapDisabled, backend, o.CORSAllowedOrigins, inmemstore.New())
testutil.CleanupCloser(t, s)

s.SetP2P(o.P2P)
Expand All @@ -234,9 +237,10 @@ func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket.
WsPingPeriod: o.WsPingPeriod,
}, extraOpts, 1, erc20)

s.MountTechnicalDebug()
s.MountDebug()
s.MountAPI()
s.Mount()
if !o.FullAPIDisabled {
s.EnableFullAPI()
}

if o.DirectUpload {
chanStore = newChanStore(o.Storer.PusherFeed())
Expand Down Expand Up @@ -319,7 +323,7 @@ func TestParseName(t *testing.T) {
const bzzHash = "89c17d0d8018a19057314aa035e61c9d23c47581a61dd3a79a7839692c617e4d"
log := log.Noop

var errInvalidNameOrAddress = errors.New("invalid name or bzz address")
errInvalidNameOrAddress := errors.New("invalid name or bzz address")

testCases := []struct {
desc string
Expand Down Expand Up @@ -380,7 +384,8 @@ func TestParseName(t *testing.T) {

s := api.New(pk.PublicKey, pk.PublicKey, common.Address{}, nil, log, nil, nil, 1, false, false, nil, []string{"*"}, inmemstore.New())
s.Configure(signer, nil, api.Options{}, api.ExtraOptions{Resolver: tC.res}, 1, nil)
s.MountAPI()
s.Mount()
s.EnableFullAPI()

tC := tC
t.Run(tC.desc, func(t *testing.T) {
Expand Down Expand Up @@ -506,9 +511,7 @@ func TestPostageHeaderError(t *testing.T) {
func TestOptions(t *testing.T) {
t.Parallel()

var (
client, _, _, _ = newTestServer(t, testServerOptions{})
)
client, _, _, _ := newTestServer(t, testServerOptions{})
for _, tc := range []struct {
endpoint string
expectedMethods string // expectedMethods contains HTTP methods like GET, POST, HEAD, PATCH, DELETE, OPTIONS. These are in alphabetical sorted order
Expand Down
Loading

0 comments on commit a50e693

Please sign in to comment.