Documentation ¶
Index ¶
- Variables
- func ApplyFuncIfNoError(ctx sdk.Context, f func(ctx sdk.Context) error) (err error)
- func BinarySearch(f func(input sdk.Int) (sdk.Int, error), lowerbound sdk.Int, upperbound sdk.Int, ...) (sdk.Int, error)
- func ConditionalPanic(t *testing.T, expectPanic bool, sut func())
- func DecApproxEq(t *testing.T, d1 sdk.Dec, d2 sdk.Dec, tol sdk.Dec) (*testing.T, bool, string, string, string)
- func DefaultFeeString(cfg network.Config) string
- func ParseSdkIntFromString(s string, separator string) ([]sdk.Int, error)
- func ParseUint64SliceFromString(s string, separator string) ([]uint64, error)
- func PrintPanicRecoveryError(ctx sdk.Context, recoveryError interface{})
- type ErrTolerance
- type Proposal
Constants ¶
This section is empty.
Variables ¶
var ProposalFlags = []string{ cli.FlagTitle, cli.FlagDescription, cli.FlagDeposit, }
Functions ¶
func ApplyFuncIfNoError ¶
This function lets you run the function f, but if theres an error or panic drop the state machine change and log the error. If there is no error, proceeds as normal (but with some slowdown due to SDK store weirdness) Try to avoid usage of iterators in f.
func BinarySearch ¶
func BinarySearch(f func(input sdk.Int) (sdk.Int, error), lowerbound sdk.Int, upperbound sdk.Int, targetOutput sdk.Int, errTolerance ErrTolerance, maxIterations int, ) (sdk.Int, error)
Binary search inputs between [lowerbound, upperbound] to a monotonic increasing function f. We stop once f(found_input) meets the ErrTolerance constraints. If we perform more than maxIterations (or equivalently lowerbound = upperbound), we return an error.
func ConditionalPanic ¶
ConditionalPanic checks if expectPanic is true, asserts that sut (system under test) panics. If expectPanic is false, asserts that sut does not panic. returns true if sut panics and false it it does not
func DecApproxEq ¶
func DecApproxEq(t *testing.T, d1 sdk.Dec, d2 sdk.Dec, tol sdk.Dec) (*testing.T, bool, string, string, string)
intended to be used with require/assert: require.True(DecEq(...)) TODO: Replace with function in SDK types package when we update
func DefaultFeeString ¶
func ParseSdkIntFromString ¶
func PrintPanicRecoveryError ¶
PrintPanicRecoveryError error logs the recoveryError, along with the stacktrace, if it can be parsed. If not emits them to stdout.
Types ¶
type ErrTolerance ¶
ErrTolerance is used to define a compare function, which checks if two ints are within a certain error tolerance of one another. ErrTolerance.Compare(a, b) returns true iff: |a - b| <= AdditiveTolerance |a - b| / min(a, b) <= MultiplicativeTolerance Each check is respectively ignored if the entry is nil (sdk.Dec{}, sdk.Int{}) Note that if AdditiveTolerance == 0, then this is equivalent to a standard compare.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
package partialord allows one to define partial orderings, and derive a total ordering
|
package partialord allows one to define partial orderings, and derive a total ordering |
internal/dag
Package dag implements a simple Directed Acyclical Graph (DAG) for deterministic topological sorts
|
Package dag implements a simple Directed Acyclical Graph (DAG) for deterministic topological sorts |