🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/eddyjlhaigh/cardano-test-framework

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/eddyjlhaigh/cardano-test-framework

v0.0.0-20210218072241-e56759f5a463
Source
Go
Version published
Created
Source

Cardano Test Framework Prototype

A prototype to see if gRPC would be a valid tool to help with Cardano test frameworks.

Summary

This project consists of two services - a client and a server. These communicate over gRPC and implement functions over cardano-cli. The server should be placed in an environment that contains an instance of cardano-cli and cardano-node. The server has several rpc methods that allow you to run commands from the client. You can launch a server by running server -p 50005 if you have the stand-alone executable and there is a dummy client to test this with by running client -p 50005.

Requirements:

  • Golang 1.15
  • Protobuf Compiler 3.0

Installation notes can be found here https://grpc.io/docs/languages/go/quickstart/

Usage

Building and Running

./proto-gen.sh compiles .proto files ./run-server.sh <port> and ./run-client.sh <port> runs a server and client. ./build-server.sh and ./build-client.sh builds a server and client.

Contributing

There are five key files.

  • ./internal/proto-files/service/node-service.proto
  • ./internal/grpc/service/node-service.pb.go
  • ./internal/grpc/impl/node-service.go
  • ./cmd/grpc/server/main.go
  • ./cmd/grpc/client/main.go

node-service.proto contains the data structures and gRPC methods that you want to have. By compiling these with ./proto-gen.sh, node-service.pb.go is generated and used by both the client and server. Note then that the node-service.proto is coupled between the two services. On the server, node-service.go implements the methods in node-service.proto and this is then registered in server/main.go. client/main.go has a copy of node-service.pb.go so that it knows what methods are available and what data types they require/respond wtih, but no other details are expected.

Therefore to extend this project with a new gRPC method, you would need to add it to node-service.proto along with its request and response arguments types (a string is acceptable!). Compiling this with ./proto-gen.sh will create a Golang file however you can install a different proto compiler to generate other languages. Following this, you would need to implement the function in node-service.go as per the other methods already there. Finally, you would want to add this function to client/main.go so that you can use it.

FAQs

Package last updated on 18 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts