relayer

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 44 Imported by: 0

README

Relayer

Compile protobuf

# in lava folder
bash ./relayer/compile_proto.sh

Run relayer server

# in lava folder
lavad server 127.0.0.1 2222 wss://mainnet.infura.io/ws/v3/<your_token> 0 --from bob

Run relayer test client

# in lava folder
lavad test_client 0 --from alice

Run portal server

# in lava folder
lavad portal_server 127.0.0.1 3333 0 --from user2
geth attach ws://127.0.0.1:3333/ws
debug

for a more verbose logging use the flag: --log_level debug

Debug the relayer mutexes

This flag turns on warnings for mutexes thay are locked for a long time

# in lava folder
DEBUG_MUTEX="true" make # make with this flag on
# Run any of the above with the compiled lavad
build/lavad server 127.0.0.1 2222 wss://mainnet.infura.io/ws/v3/<your_token> 0 --from bob

Hide Portal Errors for consumer requests

This flag will show only a unique identifier id for each error.

If the flag is true:

curl -X GET "http://127.0.0.1:3340/1/nbobo"
{"error": "unsupported api","more_information" Error guid: GUID2756376310285318670}% 

If the flag is off

curl -X GET "http://127.0.0.1:3340/1/nbobo"
{"error": "unsupported api","more_information" Error guid: GUID55979968042711362, Error: REST Api not supported /nbobo }%

To run the flag use the make file with the following command

off:

MASK_CONSUMER_LOGS="false"; make build

on:

MASK_CONSUMER_LOGS="false"; make build

Documentation

Index

Constants

View Source
const (
	RETRY_INCORRECT_SEQUENCE      = 5
	TimeWaitInitializeChainSentry = 10
	RetryInitAttempts             = 10
)

Variables

This section is empty.

Functions

func PortalServer

func PortalServer(
	ctx context.Context,
	clientCtx client.Context,
	txFactory tx.Factory,
	listenAddr string,
	chainID string,
	apiInterface string,
	flagSet *pflag.FlagSet,
)

func SendVoteCommitment

func SendVoteCommitment(voteID string, vote *voteData)

func SendVoteReveal

func SendVoteReveal(voteID string, vote *voteData)

func Server

func Server(
	ctx context.Context,
	clientCtx client.Context,
	txFactory tx.Factory,
	listenAddr string,
	nodeUrl string,
	chainID string,
	apiInterface string,
	flagSet *pflag.FlagSet,
)

func TestClient

func TestClient(
	ctx context.Context,
	txFactory tx.Factory,
	clientCtx client.Context,
	chainID string,
	apiInterface string,
	duration int64,
	flagSet *pflag.FlagSet,
)

Types

type RelaySession

type RelaySession struct {
	CuSum            uint64
	UniqueIdentifier uint64
	Lock             utils.LavaMutex
	Proof            *pairingtypes.RelayRequest // saves last relay request of a session as proof
	RelayNum         uint64
	PairingEpoch     uint64
	// contains filtered or unexported fields
}

func (*RelaySession) GetPairingEpoch

func (r *RelaySession) GetPairingEpoch() uint64

func (*RelaySession) SetPairingEpoch

func (r *RelaySession) SetPairingEpoch(epoch uint64)

type UserSessions

type UserSessions struct {
	Sessions      map[uint64]*RelaySession
	Subs          map[string]*subscription // key: subscriptionID
	IsBlockListed bool

	Lock utils.LavaMutex
	// contains filtered or unexported fields
}

type UserSessionsEpochData

type UserSessionsEpochData struct {
	UsedComputeUnits uint64
	MaxComputeUnits  uint64
	DataReliability  *pairingtypes.VRFData
	VrfPk            utils.VrfPubKey
}

Directories

Path Synopsis
rpcclient
package rpcclient implements bi-directional JSON-RPC 2.0 on multiple transports.
package rpcclient implements bi-directional JSON-RPC 2.0 on multiple transports.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL