-
Notifications
You must be signed in to change notification settings - Fork 7
Generators necessary for creating transactions and scenarios. #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hey @Riley-Kilgore Apologies for leaving this hanging. I defer to @KtorZ for his judgement on these things. He's got some blame on these commits and I'm guessing there's been some discussion on design and design choices that are out of (my) band. There's quite a lot here. I'd very much to see these features added. I have questions. From a browse all the 'gen' methods in modules named test prop_any_ada_only_value(v via any_ada_only_value()) {
let n = assets.lovelace_of(v)
label(
if n <= 0 {
@"[-255; 0]"
} else if n < 256 {
@"]0; 255]"
} else {
@"n > 255"
},
)
True
}Results in Quite unrepresentative of ada values in utxos in the wild. Other methods such as
Digression: This is a thread @KtorZ and I were discussing many moons ago. Address looks like a genuine Not familiar enough with certs to digest that module. Looks fine. |
|
Hey @waalge , thanks for the feedback. I'll try to address some of the concerns brought up in a commit I am now working on. I have also started working on a bench-marking tool, which will initially use the existing property based tests that users define, but will also accommodate to |
|
Sounds good. In these constrained environments, I see benchmarking as relevant as fuzzing. I don't really have an intuition as to how benchmarking is / will work. Update: 'Consensus' is: circular dependencies allowed at a lib level (... I'm guessing not at module level? Not so important) https://github.com/aiken-lang/stdlib/blob/main/lib/aiken/cbor.test.ak Fuzz depends on stdlib, and any tests in stdlib depend on fuzz. |
|
Hello, I just noticed this PR. I have an idea for address and credential fuzzers. Something like, test prop1(
multi_purpose_validator_address via address_fuzzer(
FromScript(Fuzzed),
WithTheSameDelegationScriptOrKey
),
) { .. }test prop2(
known_script_address via address_fuzzer(
FromScript(Specified(#"00000000000000000000000000000000000000000000000000000000")),
WithDelegationScript(Fuzzed) // or WithDelegationKey | WithNoDelegation | etc
),
) { .. }test prop3(
known_stake_address via address_fuzzer(
FromKey(Fuzzed), // or FromScript | FromFuzzed
WithDelegationKey(Specified(#"00000000000000000000000000000000000000000000000000000000"))
),
) { .. }test prop4(
random_address via address_fuzzer(
FromFuzzed,
WithFuzzedDelegationKey
),
) { .. }A work in progress: https://github.com/aiken-extra/test_kit/blob/main/lib/test_kit/fuzzy/fuzzer.ak Example run: ┍━ test_fuzzer ━━━━━━━━━━━━━
│ PASS [after 2 tests] prop1
│ · with coverage
│ | [_ 122([_ h'29A848D7E71981B2C107315236289CDEE021BB3777D69F7D4C0699DF']), 121([_ 121([_ 122([_ h'29A848D7E71981B2C107315236289CDEE021BB3777D69F7D4C0699DF'])])])] 50.0%
│ | [_ 122([_ h'C98B1EBFB739F1FA73B6260FF323A158742472ECE88A6C554F09B80F']), 121([_ 121([_ 122([_ h'C98B1EBFB739F1FA73B6260FF323A158742472ECE88A6C554F09B80F'])])])] 50.0%
│ PASS [after 2 tests] prop2
│ · with coverage
│ | [_ 122([_ h'00000000000000000000000000000000000000000000000000000000']), 121([_ 121([_ 122([_ h'29A848D7E71981B2C107315236289CDEE021BB3777D69F7D4C0699DF'])])])] 50.0%
│ | [_ 122([_ h'00000000000000000000000000000000000000000000000000000000']), 121([_ 121([_ 122([_ h'C98B1EBFB739F1FA73B6260FF323A158742472ECE88A6C554F09B80F'])])])] 50.0%
│ PASS [after 2 tests] prop3
│ · with coverage
│ | [_ 121([_ h'29A848D7E71981B2C107315236289CDEE021BB3777D69F7D4C0699DF']), 121([_ 121([_ 121([_ h'00000000000000000000000000000000000000000000000000000000'])])])] 50.0%
│ | [_ 121([_ h'C98B1EBFB739F1FA73B6260FF323A158742472ECE88A6C554F09B80F']), 121([_ 121([_ 121([_ h'00000000000000000000000000000000000000000000000000000000'])])])] 50.0%
┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ with --seed=3868951534 → 3 tests | 3 passed | 0 failed |
b01a7be to
b03d047
Compare
The strategy is to map every type from stdlib to its own "general fuzzer" taking no argument and yielding a fully arbitrary value; or, have `_with` fine-grained fuzzers for each of the type's variants that take additional fuzzers as arguments. We're also thinking that having those fuzzers check for well-formness of data (e.g. policy id is 28 bytes) is a good idea, so that what comes out of those is somewhat well-formed data and phase-1 validations down the line are simplified.
Some of the work in this PR is upstreamed from https://github.com/CardanoSolutions/zhuliChanges to the upstreamed work include a small fix made to
any_value_extending, and else branches are now supported inscenario.ak.Additionally a number of new functionalities are introduced such as generating constrained values, inputs, outputs, and a rudimentary balancing function for transactions.Example usage of the new tx generator functions can be found here: https://gist.github.com/Riley-Kilgore/47a938e5cba59f0dfaa1e61a06d14e97Example usage of scenarios can be found here: https://github.com/CardanoSolutions/zhuli/blob/main/validators/zhuli.test.ak
We have decided to limit the scope of this PR; we have a current focus on ensuring that the API is appropriate for different cardano-specific Aiken fuzzers. We will reintroduce a PR for the transaction specific contents that was a part of the PR shortly after the PR is merged. The same decision has been made surrounding the scenario.ak contents of the PR that previously existed here.