app

package
v0.0.0-...-8242388 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeTypeOK              uint32 = 0
	CodeTypeEncodingError   uint32 = 1
	CodeTypeInvalidTxFormat uint32 = 2
	CodeTypeBanned          uint32 = 3
)
View Source
const ApplicationVersion = 1
View Source
const CurseWordsLimitVE = 10

Variables

This section is empty.

Functions

func DeduplicateCurseWords

func DeduplicateCurseWords(inWords string) string

func UpdateOrSetUser

func UpdateOrSetUser(db *model.DB, uname string, toBan bool, txn *badger.Txn) error

Types

type AppState

type AppState struct {
	DB     *model.DB
	Size   int64 `json:"size"`
	Height int64 `json:"height"`
}

func (AppState) Hash

func (s AppState) Hash() []byte

type Config

type Config struct {
	ChainID    string `toml:"chain_id"`
	CurseWords string `toml:"curse_words"`
}

func LoadConfig

func LoadConfig(file string) (*Config, error)

func (Config) Validate

func (cfg Config) Validate() error

Validate validates the configuration. We don't do exhaustive config validation here, instead relying on Testnet.Validate() to handle it.

type ForumApp

type ForumApp struct {
	abci.BaseApplication

	CurseWords string
	// contains filtered or unexported fields
}

func NewForumApp

func NewForumApp(dbDir string, appConfigPath string) (*ForumApp, error)

func (*ForumApp) CheckTx

CheckTx handles validation of inbound transactions. If a transaction is not a valid message, or if a user does not exist in the database or if a user is banned it returns an error

func (*ForumApp) Commit

Commit the application state

func (*ForumApp) ExtendVote

ExtendVote returns curse words as vote extensions

func (*ForumApp) FinalizeBlock

FinalizeBlock Deliver the decided block to the Application

func (*ForumApp) Info

func (app *ForumApp) Info(_ context.Context, info *abci.InfoRequest) (*abci.InfoResponse, error)

Info return application information

func (*ForumApp) InitChain

InitChain initializes the blockchain with information sent from CometBFT such as validators or consensus parameters

func (*ForumApp) PrepareProposal

PrepareProposal is used to prepare a proposal for the next block in the blockchain. The application can re-order, remove or add transactions

func (*ForumApp) ProcessProposal

ProcessProposal validates the proposed block and the transactions and return a status if it was accepted or rejected

func (*ForumApp) Query

func (app *ForumApp) Query(ctx context.Context, query *abci.QueryRequest) (*abci.QueryResponse, error)

Query the application state for specific information

func (*ForumApp) VerifyVoteExtension

VerifyVoteExtension verifies the vote extensions and ensure they include the curse words It will not be called for extensions generated by this validator

Jump to

Keyboard shortcuts

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