util

package
v0.0.0-...-dfc2b99 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: ISC Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const Conf_AnnHash_MEMOHASH_CYCLES = 2

How many times to run memohash when creating an item for announcement hashing

View Source
const Conf_AnnHash_RANDHASH_CYCLES = 4

How many times to run the random hash program per announcement hash cycle

View Source
const Conf_PacketCrypt_ANN_WAIT_PERIOD = 3

parentBlockHeight -> x -> y -> valid

0            1    2      3
View Source
const Conf_RandGen_BRANCH_COST = 50
View Source
const Conf_RandGen_HIGHER_SCOPE_LIKELYHOOD = 4

25% chance that an input variable will come from a higher scope

View Source
const Conf_RandGen_IMMEDIATE_LIKELYHOOD = 4

25% chance that an op uses an immediate input rather than a variable

View Source
const Conf_RandGen_INITIAL_BUDGET = 20000

How complex of a program do we want to create ? Most operations have a "cost" equal to the number of inputs to the op. Loops multiply the cost of the operations within by the number of cycles of the loop. RandGen stops generating the hash program when the budget is exhausted.

View Source
const Conf_RandGen_INPUT_COST = 2
View Source
const Conf_RandGen_LOOP_MIN_CYCLES = 2

Loops have random numbers of cycles, these are the bounds of the random numbers. The max cycles become more as the scope depth grows, this helps stabilize the size of programs because outer loops have few cycles and thus spend less budget but inner loops have many more.

View Source
const Conf_RandGen_MAX_INSNS = 2048
View Source
const Conf_RandGen_MEMORY_COST = 20

Some operations are more complicated than normal and have particular costs.

View Source
const Conf_RandGen_MIN_INSNS = 0

Programs which are created with fewer than MIN_INSNS or more than MAX_INSNS are deemed invalid and the hash attempt is failed.

View Source
const Conf_RandGen_RANDOM_BRANCH_LIKELYHOOD = 2

50% chance that an if statement is completely unpredictable

View Source
const Conf_RandGen_VAR_REUSE_LIKELYHOOD = 8

12.5% chance that a variable used in an op is one which has been used before

View Source
const Conf_RandHash_MAX_OPS = 20000
View Source
const Conf_RandHash_MIN_OPS = 0

RandHash rules, if a program requires fewer than MIN_OPS or more than MAX_OPS cycles to complete, it will be deemed invalid and the hashing attempt is failed.

Variables

This section is empty.

Functions

func Conf_RandGen_IF_BODY_BUDGET

func Conf_RandGen_IF_BODY_BUDGET(budget int, scopes int) int

How much budget remains after we enter an if sub-scope Technically it should be 100% because only one of the two branches will be taken but reducing it a bit helps make the code more compact and convoluted.

func Conf_RandGen_LOOP_MAX_CYCLES

func Conf_RandGen_LOOP_MAX_CYCLES(scopeDepth int) int

func Conf_RandGen_SHOULD_BRANCH

func Conf_RandGen_SHOULD_BRANCH(rand uint32, insnCount int) bool

func Conf_RandGen_SHOULD_LOOP

func Conf_RandGen_SHOULD_LOOP(rand uint32) bool

Likelyhood in a scope that a loop or branch will be created. Loops have a flat 23 in 32 chance while branches become less likely as the number of inctructions already emitted approaches the maximum. This helps to stabilize the size of generated programs.

func DecodeInsn_HAS_IMM

func DecodeInsn_HAS_IMM(insn uint32) bool

func DecodeInsn_MEMORY_BASE

func DecodeInsn_MEMORY_BASE(insn uint32) uint32

func DecodeInsn_MEMORY_CARRY

func DecodeInsn_MEMORY_CARRY(insn uint32) uint32

func DecodeInsn_MEMORY_STEP

func DecodeInsn_MEMORY_STEP(insn uint32) uint32

func DecodeInsn_MEMORY_WITH_CARRY

func DecodeInsn_MEMORY_WITH_CARRY(insn, carry uint32) uint32

func DecodeInsn_OP

func DecodeInsn_OP(insn uint32) uint32

func DecodeInsn_REGA

func DecodeInsn_REGA(insn uint32) uint32

func DecodeInsn_REGB

func DecodeInsn_REGB(insn uint32) uint32

func DecodeInsn_imm

func DecodeInsn_imm(insn uint32) int64

func DecodeInsn_immLo

func DecodeInsn_immLo(insn uint32) int32

Types

This section is empty.

Jump to

Keyboard shortcuts

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