Skip to content

Commit

Permalink
Change Branding
Browse files Browse the repository at this point in the history
Brandning from Kaliedo -> Firefly
* strip `kld` from go packages
* change HTTP to 'fly' or 'firefly' depending on length
* remove some documentation references to Kaliedo platform
* Left some TODOs for when the new docs site goes up

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
  • Loading branch information
shemnon committed Jun 1, 2021
1 parent 4d09460 commit 5d4ebf2
Show file tree
Hide file tree
Showing 112 changed files with 1,792 additions and 1,795 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ coverage.txt: $(GOFILES)
coverage.html:
$(VGO) tool cover -html=coverage.txt
mocks:
mockgen github.com/Shopify/sarama Client,ConsumerGroup,ConsumerGroupSession,ConsumerGroupClaim > internal/kldkafka/mock_sarama/sarama_mocks.go
mockgen github.com/Shopify/sarama Client,ConsumerGroup,ConsumerGroupSession,ConsumerGroupClaim > internal/kafka/mock_sarama/sarama_mocks.go
test: coverage.txt
coverage: coverage.txt coverage.html
clean: force
Expand Down
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ solidity: |-
The JSON/RPC specification exposed natively by Go-ethereum and other Ethereum
protocol implementations, provides a rich low-level API for interfacing with
the node. It is usually exposed over HTTP (as well as IPC) so can be connected
over a network, and have security layered in front of it (as has been done within
the Kaleido platform).
over a network, and have security layered in front of it.
However, applications seldom code directly to the JSON/RPC API when deploying
contracts and sending transactions, because it is:
Expand All @@ -145,7 +144,7 @@ So you ask, if the goal is simplicity, why not just put the HTTP API in front of
There are some challenges in Enterprise grade Blockchain solutions (particularly in high throughput permissioned/private chains) that cannot be solved by a stateless HTTP bridging layer alone.
So for Kaleido, we started with a robust Messaging tier and layered the HTTP interface on top.
So for Firefly, we started with a robust Messaging tier and layered the HTTP interface on top.
## The asynchronous nature of Ethereum transactions
Expand Down Expand Up @@ -224,9 +223,9 @@ trivially. Some examples as follows:

## Why Kafka?

We selected Kafka as the first Messaging platform (and built a multi-tenant secured Kafka transport into the Kaleido platform), because Kafka has message ordering and scale characteristics that are ideally suited to the Ethereum transaction model:
We selected Kafka as the first Messaging platform, because Kafka has message ordering and scale characteristics that are ideally suited to the Ethereum transaction model:
- Transactions can be sprayed across partitions, while retaining order of the transactions for a particular sender. Allowing independent and dynamic scaling of the application, kaleido-io/ethconnect bridge and Go-ethereum node components.
- The modern replication based cloud-native and continuously available architecture is ideal for the Kaleido platform, and is likely to be a good fit for the modern Microservice architectures that are common in Blockchain projects.
- The modern replication based cloud-native and continuously available architecture is ideal for Hyperledger projects, and is likely to be a good fit for the modern Microservice architectures that are common in Blockchain projects.

## Topics

Expand Down Expand Up @@ -316,8 +315,6 @@ blockchain.

## Running the Bridge

Whether you are running a Kaleido permissioned chain and want to use an instance of the kaleido-io/ethconnect bridge managed externally to the platform, or are using the OSS tool with another Ethereum network, here is how to use it.

### Installation

Requires [Go 1.11](https://golang.org/dl/) or later to install with `go get`
Expand Down Expand Up @@ -347,8 +344,8 @@ You can run a single bridge using simple commandline options, which is ideal for

```sh
$ ./ethconnect kafka --help
Copyright (C) 2018, 2019 Kaleido
For License details see https://kaleido.io/terms-of-service/
Copyright (C) 2018,2021 Kaleido
Licensed under the Apache License, Version 2.0
Version: (Build Date: )
Kafka->Ethereum (JSON/RPC) Bridge
Expand Down Expand Up @@ -384,8 +381,8 @@ Global Flags:

```
$ethconnect webhooks --help
Copyright (C) 2018, 2019 Kaleido
For License details see https://kaleido.io/terms-of-service/
Copyright (C) 2018,2021 Kaleido
Licensed under the Apache License, Version 2.0

Version: (Build Date: )

Expand Down
36 changes: 18 additions & 18 deletions cmd/ethconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
"gopkg.in/yaml.v2"

"github.com/icza/dyno"
"github.com/kaleido-io/ethconnect/internal/klderrors"
"github.com/kaleido-io/ethconnect/internal/kldkafka"
"github.com/kaleido-io/ethconnect/internal/kldrest"
"github.com/kaleido-io/ethconnect/internal/kldutils"
"github.com/kaleido-io/ethconnect/internal/errors"
"github.com/kaleido-io/ethconnect/internal/kafka"
"github.com/kaleido-io/ethconnect/internal/rest"
"github.com/kaleido-io/ethconnect/internal/utils"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
prefixed "github.com/x-cray/logrus-prefixed-formatter"
Expand All @@ -40,10 +40,10 @@ import (
// to run with a set of individual commands as goroutines
// (rather than the simple commandline mode that runs a single command)
type ServerConfig struct {
KafkaBridges map[string]*kldkafka.KafkaBridgeConf `json:"kafka"`
Webhooks map[string]*kldrest.RESTGatewayConf `json:"webhooks"`
RESTGateways map[string]*kldrest.RESTGatewayConf `json:"rest"`
Plugins PluginConfig `json:"plugins"`
KafkaBridges map[string]*kafka.KafkaBridgeConf `json:"kafka"`
Webhooks map[string]*rest.RESTGatewayConf `json:"webhooks"`
RESTGateways map[string]*rest.RESTGatewayConf `json:"rest"`
Plugins PluginConfig `json:"plugins"`
}

func initLogging(debugLevel int) {
Expand Down Expand Up @@ -108,7 +108,7 @@ func initServer() (serverCmd *cobra.Command) {
},
PreRunE: func(cmd *cobra.Command, args []string) (err error) {
if serverCmdConfig.Filename == "" {
err = klderrors.Errorf(klderrors.ConfigNoYAML)
err = errors.Errorf(errors.ConfigNoYAML)
return
}
return
Expand All @@ -126,14 +126,14 @@ func initServer() (serverCmd *cobra.Command) {
func readServerConfig() (serverConfig *ServerConfig, err error) {
confBytes, err := ioutil.ReadFile(serverCmdConfig.Filename)
if err != nil {
err = klderrors.Errorf(klderrors.ConfigFileReadFailed, serverCmdConfig.Filename, err)
err = errors.Errorf(errors.ConfigFileReadFailed, serverCmdConfig.Filename, err)
return
}
if strings.ToLower(serverCmdConfig.Type) == "yaml" {
// Convert to JSON first
yamlGenericPayload := make(map[interface{}]interface{})
if err = yaml.Unmarshal(confBytes, &yamlGenericPayload); err != nil {
err = klderrors.Errorf(klderrors.ConfigYAMLParseFile, serverCmdConfig.Filename, err)
err = errors.Errorf(errors.ConfigYAMLParseFile, serverCmdConfig.Filename, err)
return
}
genericPayload := dyno.ConvertMapI2MapS(yamlGenericPayload).(map[string]interface{})
Expand All @@ -143,7 +143,7 @@ func readServerConfig() (serverConfig *ServerConfig, err error) {
serverConfig = &ServerConfig{}
err = json.Unmarshal(confBytes, serverConfig)
if err != nil {
err = klderrors.Errorf(klderrors.ConfigYAMLPostParseFile, serverCmdConfig.Filename, err)
err = errors.Errorf(errors.ConfigYAMLPostParseFile, serverCmdConfig.Filename, err)
return
}

Expand All @@ -161,15 +161,15 @@ func startServer() (err error) {
}

if rootConfig.PrintYAML {
b, err := kldutils.MarshalToYAML(&serverConfig)
b, err := utils.MarshalToYAML(&serverConfig)
print("# Full YAML configuration processed from supplied file\n" + string(b))
return err
}

anyRoutineFinished := make(chan bool)
var dontPrintYaml = false
for name, conf := range serverConfig.KafkaBridges {
kafkaBridge := kldkafka.NewKafkaBridge(&dontPrintYaml)
kafkaBridge := kafka.NewKafkaBridge(&dontPrintYaml)
kafkaBridge.SetConf(conf)
if err := kafkaBridge.ValidateConf(); err != nil {
return err
Expand All @@ -184,13 +184,13 @@ func startServer() (err error) {
}
// Merge in legacy named 'webbhooks' configs
if serverConfig.RESTGateways == nil {
serverConfig.RESTGateways = make(map[string]*kldrest.RESTGatewayConf)
serverConfig.RESTGateways = make(map[string]*rest.RESTGatewayConf)
}
for name, conf := range serverConfig.Webhooks {
serverConfig.RESTGateways[name] = conf
}
for name, conf := range serverConfig.RESTGateways {
restGateway := kldrest.NewRESTGateway(&dontPrintYaml)
restGateway := rest.NewRESTGateway(&dontPrintYaml)
restGateway.SetConf(conf)
if err := restGateway.ValidateConf(); err != nil {
return err
Expand Down Expand Up @@ -218,10 +218,10 @@ func init() {
serverCmd := initServer()
rootCmd.AddCommand(serverCmd)

kafkaBridge := kldkafka.NewKafkaBridge(&rootConfig.PrintYAML)
kafkaBridge := kafka.NewKafkaBridge(&rootConfig.PrintYAML)
rootCmd.AddCommand(kafkaBridge.CobraInit())

restGateway := kldrest.NewRESTGateway(&rootConfig.PrintYAML)
restGateway := rest.NewRESTGateway(&rootConfig.PrintYAML)
rootCmd.AddCommand(restGateway.CobraInit("webhooks")) // for backwards compatibility
rootCmd.AddCommand(restGateway.CobraInit("rest"))
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package cmd
import (
"plugin"

"github.com/kaleido-io/ethconnect/internal/kldauth"
"github.com/kaleido-io/ethconnect/internal/klderrors"
"github.com/kaleido-io/ethconnect/pkg/kldplugins"
"github.com/kaleido-io/ethconnect/internal/auth"
"github.com/kaleido-io/ethconnect/internal/errors"
"github.com/kaleido-io/ethconnect/pkg/plugins"
log "github.com/sirupsen/logrus"
)

Expand All @@ -45,14 +45,14 @@ func loadSecurityModulePlugin(conf *PluginConfig) error {
log.Debugf("Loading SecurityModule plugin '%s'", modulePath)
smPlugin, err := plugin.Open(modulePath)
if err != nil {
return klderrors.Errorf(klderrors.SecurityModulePluginLoad, err)
return errors.Errorf(errors.SecurityModulePluginLoad, err)
}

smSymbol, err := smPlugin.Lookup("SecurityModule")
if err != nil || smSymbol == nil {
return klderrors.Errorf(klderrors.SecurityModulePluginSymbol, modulePath, err)
return errors.Errorf(errors.SecurityModulePluginSymbol, modulePath, err)
}

kldauth.RegisterSecurityModule(*smSymbol.(*kldplugins.SecurityModule))
auth.RegisterSecurityModule(*smSymbol.(*plugins.SecurityModule))
return nil
}
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ coverage:
threshold: 0.1%
ignore:
- "internal/eth" # Dynamic dependency library loading - relied on by other tests
- "internal/kldkafka/mock_sarama" # Generated mock
- "internal/kldauth/kldauthtest" # Mock
- "internal/kafka/mock_sarama" # Generated mock
- "internal/auth/authtest" # Mock
- "cmd/plugins.go" # Not testable with UTs
40 changes: 20 additions & 20 deletions internal/kldauth/auth.go → internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,38 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package kldauth
package auth

import (
"context"

"github.com/kaleido-io/ethconnect/internal/klderrors"
"github.com/kaleido-io/ethconnect/pkg/kldplugins"
"github.com/kaleido-io/ethconnect/internal/errors"
"github.com/kaleido-io/ethconnect/pkg/plugins"
)

type kldContextKey int
type ContextKey int

const (
kldContextKeySystemAuth kldContextKey = iota
kldContextKeyAuthContext
kldContextKeyAccessToken
ContextKeySystemAuth ContextKey = iota
ContextKeyAuthContext
ContextKeyAccessToken
)

var securityModule kldplugins.SecurityModule
var securityModule plugins.SecurityModule

// RegisterSecurityModule is the plug point to register a security module
func RegisterSecurityModule(sm kldplugins.SecurityModule) {
func RegisterSecurityModule(sm plugins.SecurityModule) {
securityModule = sm
}

// NewSystemAuthContext creates a system background context
func NewSystemAuthContext() context.Context {
return context.WithValue(context.Background(), kldContextKeySystemAuth, true)
return context.WithValue(context.Background(), ContextKeySystemAuth, true)
}

// IsSystemContext checks if a context was created as a system context
func IsSystemContext(ctx context.Context) bool {
b, ok := ctx.Value(kldContextKeySystemAuth).(bool)
b, ok := ctx.Value(ContextKeySystemAuth).(bool)
return ok && b
}

Expand All @@ -54,21 +54,21 @@ func WithAuthContext(ctx context.Context, token string) (context.Context, error)
if err != nil {
return nil, err
}
ctx = context.WithValue(ctx, kldContextKeyAccessToken, token)
ctx = context.WithValue(ctx, kldContextKeyAuthContext, ctxValue)
ctx = context.WithValue(ctx, ContextKeyAccessToken, token)
ctx = context.WithValue(ctx, ContextKeyAuthContext, ctxValue)
return ctx, nil
}
return ctx, nil
}

// GetAuthContext extracts a previously stored auth context from the context
func GetAuthContext(ctx context.Context) interface{} {
return ctx.Value(kldContextKeyAuthContext)
return ctx.Value(ContextKeyAuthContext)
}

// GetAccessToken extracts a previously stored access token
func GetAccessToken(ctx context.Context) string {
v, ok := ctx.Value(kldContextKeyAccessToken).(string)
v, ok := ctx.Value(ContextKeyAccessToken).(string)
if ok {
return v
}
Expand All @@ -80,7 +80,7 @@ func AuthRPC(ctx context.Context, method string, args ...interface{}) error {
if securityModule != nil && !IsSystemContext(ctx) {
authCtx := GetAuthContext(ctx)
if authCtx == nil {
return klderrors.Errorf(klderrors.SecurityModuleNoAuthContext)
return errors.Errorf(errors.SecurityModuleNoAuthContext)
}
return securityModule.AuthRPC(authCtx, method, args...)
}
Expand All @@ -92,7 +92,7 @@ func AuthRPCSubscribe(ctx context.Context, namespace string, channel interface{}
if securityModule != nil && !IsSystemContext(ctx) {
authCtx := GetAuthContext(ctx)
if authCtx == nil {
return klderrors.Errorf(klderrors.SecurityModuleNoAuthContext)
return errors.Errorf(errors.SecurityModuleNoAuthContext)
}
return securityModule.AuthRPCSubscribe(authCtx, namespace, channel, args...)
}
Expand All @@ -104,7 +104,7 @@ func AuthEventStreams(ctx context.Context) error {
if securityModule != nil && !IsSystemContext(ctx) {
authCtx := GetAuthContext(ctx)
if authCtx == nil {
return klderrors.Errorf(klderrors.SecurityModuleNoAuthContext)
return errors.Errorf(errors.SecurityModuleNoAuthContext)
}
return securityModule.AuthEventStreams(authCtx)
}
Expand All @@ -116,7 +116,7 @@ func AuthListAsyncReplies(ctx context.Context) error {
if securityModule != nil && !IsSystemContext(ctx) {
authCtx := GetAuthContext(ctx)
if authCtx == nil {
return klderrors.Errorf(klderrors.SecurityModuleNoAuthContext)
return errors.Errorf(errors.SecurityModuleNoAuthContext)
}
return securityModule.AuthListAsyncReplies(authCtx)
}
Expand All @@ -128,7 +128,7 @@ func AuthReadAsyncReplyByUUID(ctx context.Context) error {
if securityModule != nil && !IsSystemContext(ctx) {
authCtx := GetAuthContext(ctx)
if authCtx == nil {
return klderrors.Errorf(klderrors.SecurityModuleNoAuthContext)
return errors.Errorf(errors.SecurityModuleNoAuthContext)
}
return securityModule.AuthReadAsyncReplyByUUID(authCtx)
}
Expand Down
Loading

0 comments on commit 5d4ebf2

Please sign in to comment.