I am trying to write a test case in Tezos Sandbox that uses an On Chain Contract Call. To start with, I am trying to implement the example from SmartPy "On Chain Contract Calls - Collatz" from the reference example.
I can originate the three contracts (OnEven, OnOdd, Collatz at the bottom for reference) successfully, however when I run the main Collatz contract with '42' as the input, I get the following error:
(venv) $ poetry run python3 test_collatz.py
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-node identity generate 0.0 --data-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-node.7e5dk4oc
Generating a new identity... (level: 0.00)
Stored the new identity (idsbZ4AcTjLUTgzQQAXKpFwRM31MUX) into '/var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-node.7e5dk4oc/identity.json'.
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-node config init --data-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-node.7e5dk4oc --net-addr 127.0.0.1:19730 --rpc-addr 127.0.0.1:18730 --expected-pow 0.0 --connections 500 --bootstrap-threshold 0 --private-mode --network sandbox
Created /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-node.7e5dk4oc/config.json for network: sandbox.
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-node run --data-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-node.7e5dk4oc --no-bootstrap-peers --connections 500 --bootstrap-threshold 0 --private-mode --network sandbox --peer 127.0.0.1:19730 --peer 127.0.0.1:19731 --peer 127.0.0.1:19732 --peer 127.0.0.1:19733 --peer 127.0.0.1:19734 --peer 127.0.0.1:19735 --peer 127.0.0.1:19736 --peer 127.0.0.1:19737 --peer 127.0.0.1:19738 --peer 127.0.0.1:19739 --peer 127.0.0.1:19740 --peer 127.0.0.1:19741 --peer 127.0.0.1:19742 --peer 127.0.0.1:19743 --peer 127.0.0.1:19744 --peer 127.0.0.1:19745 --peer 127.0.0.1:19746 --peer 127.0.0.1:19747 --peer 127.0.0.1:19748 --peer 127.0.0.1:19749 --peer 127.0.0.1:19750 --peer 127.0.0.1:19751 --peer 127.0.0.1:19752 --peer 127.0.0.1:19753 --peer 127.0.0.1:19754 --peer 127.0.0.1:19755 --peer 127.0.0.1:19756 --peer 127.0.0.1:19757 --peer 127.0.0.1:19758 --peer 127.0.0.1:19759 --peer 127.0.0.1:19760 --peer 127.0.0.1:19761 --peer 127.0.0.1:19762 --peer 127.0.0.1:19763 --peer 127.0.0.1:19764 --peer 127.0.0.1:19765 --peer 127.0.0.1:19766 --peer 127.0.0.1:19767 --peer 127.0.0.1:19768 --peer 127.0.0.1:19769 --peer 127.0.0.1:19770 --peer 127.0.0.1:19771 --peer 127.0.0.1:19772 --peer 127.0.0.1:19773 --peer 127.0.0.1:19774
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 rpc get /network/version
{ "chain_name": "TEZOS", "distributed_db_version": 0, "p2p_version": 1 }
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 -w none config update
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key bootstrap1 unencrypted:edsk3gUfUPyBSfrS9CCgmCiQsTCHGkviBDusMxDJstFtojtc1zcpsh
Tezos address added: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key bootstrap2 unencrypted:edsk39qAm1fiMjgmPkw1EgQYkMzkJezLNewd7PLNHTkr6w9XA2zdfo
Tezos address added: tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key bootstrap3 unencrypted:edsk4ArLQgBTLWG5FJmnGnT689VKoqhXwmDPBuGx3z4cvwU9MmrPZZ
Tezos address added: tz1faswCTDciRzE4oJ9jn2Vm2dvjeyA9fUzU
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key bootstrap4 unencrypted:edsk2uqQB9AY4FvioK2YMdfmyMrer5R8mGFyuaLLFfSRo8EoyNdht3
Tezos address added: tz1b7tUupMgCNw2cCLpKTkSD1NZzB5TkP2sv
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key bootstrap5 unencrypted:edsk4QLrcijEffxV31gGdN2HU7UpyJjA8drFoNcmnB28n89YjPNRFm
Tezos address added: tz1ddb9NMYHZi5UzPdzTZMYQQZoMub195zgv
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key baker1_key unencrypted:edsk432L71B91i1sE8rQxPDMo2Yxo4qaYqhktvpt8yovaMpo1NUbBt
Tezos address added: tz1UJbFsTQfdpa1qYrqHG9Ykw834AXi5WqRR
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key baker2_key unencrypted:edsk3jjD4cLvE1t3SiZKCRiH9SXnJ4jHEsVpfcuRwfe7sfbnsMGX6f
Tezos address added: tz1fWJ2oeeG6h2r61XY1wen2sV87AvCqGjAU
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key baker3_key unencrypted:edsk3EVDFeDsefk1UoWWhDhnBpERhAwqHbVzWnBwA4tdUL8aBhw7RC
Tezos address added: tz1SERFDUknkjJTas8sUco7dskxWrUWhTc2s
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key baker4_key unencrypted:edsk2rAmeBDrQ5d1FhDoTdifMvBsqSosmPSBhxL74huszZhfMFtiKb
Tezos address added: tz1eJ9yR95LmJgVrGLvgt56T6ngCFcgjLo2S
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key baker5_key unencrypted:edsk4Ssc63dnYJUptVMaKfmHLJNMBYv9piYiRCiYjcH3gacKWP1z3v
Tezos address added: tz1cwoRFe3BzJv9nZZBA5fk8uV6w9AVVrBF9
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 import secret key activator unencrypted:edsk31vznjHSSpGExDMHYASz45VZqXN4DPxvsa4hAyY8dHM28cZzp6
Tezos address added: tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 -block genesis activate protocol ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK with fitness 1 and key activator and parameters /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tmp9oinifd6 --timestamp 2020-10-02T03:14:28Z
Injected BMX21PfKmNUf
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 remember contract baker1 SG1fpFaowYY8G7PfkYdKkGmsMziHKUfrHRHW
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 remember contract baker2 SG1TLmKJHVJxQosY6iN21AW77HsAapdupxnR
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 remember contract baker3 SG1hExdK69Z2RZkkQjKtLG6H4L4FGTZeGKHu
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 remember contract baker4 SG1mHgeWHGMnCUMJ8jZ1Cdh3DkWEcQ88tziJ
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 remember contract baker5 SG1jfZeHRzeWAM1T4zrwunEyUpwWc82D4tbv
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-baker-alpha -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://127.0.0.1:18730 run with local node /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-node.7e5dk4oc baker5
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 originate contract even_contract transferring 0 from bootstrap1 running collatz_even.tz --init Unit --burn-cap 9
Node is bootstrapped.
Estimated gas: 13465000 units (will add 100000 for safety)
Estimated storage: 376 bytes added (will add 20 for safety)
Operation successfully injected in the node.
Operation hash is 'onup8WwVpbKefbRQnSS4KfLKDj8gJnr63Dn1hsyCkQ8nx2piVNC'
NOT waiting for the operation to be included.
Use command
tezos-client wait for onup8WwVpbKefbRQnSS4KfLKDj8gJnr63Dn1hsyCkQ8nx2piVNC to be included --confirmations 30 --branch BM1zDZAxWwwGxduLzdPtaNu6nr5MygyxjFpcJBbtoHpVYvZRRgY
and/or an external block explorer to make sure that it has been included.
This sequence of operations was run:
Manager signed operations:
From: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
Fee to the baker: ꜩ0.001705
Expected counter: 1
Gas limit: 13565000
Storage limit: 396 bytes
Balance updates:
tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx ................ -ꜩ0.001705
fees(the baker who will include this operation,0) ... +ꜩ0.001705
Origination:
From: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
Credit: ꜩ0
Script:
{ parameter (pair (contract %k nat) (nat %x)) ;
storage unit ;
code { DUP ;
CDR ;
SWAP ;
CAR ;
DUP ;
CAR ;
NIL operation ;
SWAP ;
PUSH mutez 0 ;
PUSH nat 2 ;
DIG 4 ;
CDR ;
EDIV ;
IF_SOME { CAR } { PUSH int 14 ; FAILWITH } ;
TRANSFER_TOKENS ;
CONS ;
PAIR } }
Initial storage: Unit
No delegate for this contract
This origination was successfully applied
Originated contracts:
KT1VFgSsVQF39GhYXU5wYEMygqAAd3vBGVkJ
Storage size: 119 bytes
Paid storage size diff: 119 bytes
Consumed gas: 13465000
Balance updates:
tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx ... -ꜩ0.119
tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx ... -ꜩ0.257
New contract KT1VFgSsVQF39GhYXU5wYEMygqAAd3vBGVkJ originated.
Contract memorized as even_contract.
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 bake for baker5 --minimal-timestamp
Injected block BM7cUBY5EDju
Oct 2 04:14:37.004 - alpha.baking.forge: found 1 valid operations (0 refused) for timestamp 2020-10-02T03:14:38-00:00 (fitness 01::0000000000000005)
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 originate contract odd_contract transferring 0 from bootstrap1 running collatz_odd.tz --init Unit --burn-cap 9
Node is bootstrapped.
Estimated gas: 13083000 units (will add 100000 for safety)
Estimated storage: 357 bytes added (will add 20 for safety)
Operation successfully injected in the node.
Operation hash is 'op8cRTdDJ8xtRVsNAMzKW8mTP5PZs4UMR71cbesPKqXDYrLuoZr'
NOT waiting for the operation to be included.
Use command
tezos-client wait for op8cRTdDJ8xtRVsNAMzKW8mTP5PZs4UMR71cbesPKqXDYrLuoZr to be included --confirmations 30 --branch BM7cUBY5EDju7Mmj6TFofCua7WLsznaWrVRsbnF1jD1KCDNDwzf
and/or an external block explorer to make sure that it has been included.
This sequence of operations was run:
Manager signed operations:
From: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
Fee to the baker: ꜩ0.001648
Expected counter: 2
Gas limit: 13183000
Storage limit: 377 bytes
Balance updates:
tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx ................ -ꜩ0.001648
fees(the baker who will include this operation,0) ... +ꜩ0.001648
Origination:
From: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
Credit: ꜩ0
Script:
{ parameter (pair (contract %k int) (int %x)) ;
storage unit ;
code { DUP ;
CDR ;
SWAP ;
CAR ;
DUP ;
CAR ;
NIL operation ;
SWAP ;
PUSH mutez 0 ;
PUSH int 1 ;
DIG 4 ;
CDR ;
PUSH int 3 ;
MUL ;
ADD ;
TRANSFER_TOKENS ;
CONS ;
PAIR } }
Initial storage: Unit
No delegate for this contract
This origination was successfully applied
Originated contracts:
KT1KAVbJDYspe4RYZbrqbq7jDf8EVB7FLBdu
Storage size: 100 bytes
Paid storage size diff: 100 bytes
Consumed gas: 13083000
Balance updates:
tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx ... -ꜩ0.1
tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx ... -ꜩ0.257
New contract KT1KAVbJDYspe4RYZbrqbq7jDf8EVB7FLBdu originated.
Contract memorized as odd_contract.
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 bake for baker5 --minimal-timestamp
Injected block BLkjaU2VCQJk
Oct 2 04:14:37.815 - alpha.baking.forge: found 1 valid operations (0 refused) for timestamp 2020-10-02T03:14:40-00:00 (fitness 01::0000000000000006)
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 show known contract even_contract
KT1VFgSsVQF39GhYXU5wYEMygqAAd3vBGVkJ
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 show known contract odd_contract
KT1KAVbJDYspe4RYZbrqbq7jDf8EVB7FLBdu
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 originate contract main_contract transferring 0 from bootstrap1 running collatz_main.tz --init (Pair 0 (Pair "KT1VFgSsVQF39GhYXU5wYEMygqAAd3vBGVkJ" "KT1KAVbJDYspe4RYZbrqbq7jDf8EVB7FLBdu")) --burn-cap 9
Node is bootstrapped.
Estimated gas: 25053000 units (will add 100000 for safety)
Estimated storage: 853 bytes added (will add 20 for safety)
Operation successfully injected in the node.
Operation hash is 'ooomaEFrxKgSuE3xvEvckGR163xNz7oxUEhniSg2Pamy22ySGwQ'
NOT waiting for the operation to be included.
Use command
tezos-client wait for ooomaEFrxKgSuE3xvEvckGR163xNz7oxUEhniSg2Pamy22ySGwQ to be included --confirmations 30 --branch BLkjaU2VCQJkyxev7Pt5CVoUoAcdgx3JopQKkKiMgzJi5Fvw825
and/or an external block explorer to make sure that it has been included.
This sequence of operations was run:
Manager signed operations:
From: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
Fee to the baker: ꜩ0.003369
Expected counter: 3
Gas limit: 25153000
Storage limit: 873 bytes
Balance updates:
tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx ................ -ꜩ0.003369
fees(the baker who will include this operation,0) ... +ꜩ0.003369
Origination:
From: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
Credit: ꜩ0
Script:
{ parameter (or (unit %reset) (nat %run)) ;
storage (pair (int %counter) (pair (address %onEven) (address %onOdd))) ;
code { DUP ;
CDR ;
SWAP ;
CAR ;
IF_LEFT
{ DROP ; CDR ; PUSH int 0 ; PAIR ; NIL operation }
{ DUP ;
PUSH nat 1 ;
COMPARE ;
LT ;
IF { SWAP ;
DUP ;
CDR ;
SWAP ;
CAR ;
PUSH int 1 ;
ADD ;
PAIR ;
SWAP ;
PUSH nat 0 ;
PUSH nat 2 ;
DIG 2 ;
DUP ;
DUG 3 ;
EDIV ;
IF_SOME { CDR } { PUSH int 39 ; FAILWITH } ;
COMPARE ;
EQ ;
IF { NIL operation ;
DIG 2 ;
DUP ;
DUG 3 ;
CDAR ;
CONTRACT %run (pair (contract %k nat) (nat %x)) ;
IF_SOME {} { PUSH int 31 ; FAILWITH } ;
PUSH mutez 0 ;
DIG 3 ;
SELF ;
ADDRESS ;
CONTRACT %run nat ;
IF_SOME {} { PUSH int 33 ; FAILWITH } ;
PAIR %k %x ;
TRANSFER_TOKENS ;
CONS }
{ NIL operation ;
DIG 2 ;
DUP ;
DUG 3 ;
CDDR ;
CONTRACT %run (pair (contract %k nat) (nat %x)) ;
IF_SOME {} { PUSH int 32 ; FAILWITH } ;
PUSH mutez 0 ;
DIG 3 ;
SELF ;
ADDRESS ;
CONTRACT %run nat ;
IF_SOME {} { PUSH int 33 ; FAILWITH } ;
PAIR %k %x ;
TRANSFER_TOKENS ;
CONS } }
{ DROP ; NIL operation } } ;
PAIR } }
Initial storage:
(Pair 0
(Pair "KT1VFgSsVQF39GhYXU5wYEMygqAAd3vBGVkJ" "KT1KAVbJDYspe4RYZbrqbq7jDf8EVB7FLBdu"))
No delegate for this contract
This origination was successfully applied
Originated contracts:
KT1QjwV6cjBX3umA7ZToNqkKpjbnCxXCcM1i
Storage size: 596 bytes
Paid storage size diff: 596 bytes
Consumed gas: 25053000
Balance updates:
tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx ... -ꜩ0.596
tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx ... -ꜩ0.257
New contract KT1QjwV6cjBX3umA7ZToNqkKpjbnCxXCcM1i originated.
Contract memorized as main_contract.
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 bake for baker5 --minimal-timestamp
Injected block BMZiyR2KKY33
Oct 2 04:14:39.321 - alpha.baking.forge: found 1 valid operations (0 refused) for timestamp 2020-10-02T03:14:42-00:00 (fitness 01::0000000000000007)
# /Users/dariuscognac/Documents/GitHub/tezos/tezos-client -base-dir /var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on -endpoint http://localhost:18730 transfer 0 from bootstrap1 to main_contract --entrypoint run --burn-cap 9 --arg 42
Node is bootstrapped.
This simulation failed:
Manager signed operations:
From: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
Fee to the baker: ꜩ0
Expected counter: 4
Gas limit: 1040000000
Storage limit: 60000 bytes
Transaction:
Amount: ꜩ0
From: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
To: KT1QjwV6cjBX3umA7ZToNqkKpjbnCxXCcM1i
Entrypoint: run
Parameter: 42
This operation FAILED.
Runtime error in contract KT1QjwV6cjBX3umA7ZToNqkKpjbnCxXCcM1i:
01: { parameter (or (unit %reset) (nat %run)) ;
02: storage (pair (int %counter) (pair (address %onEven) (address %onOdd))) ;
03: code { DUP ;
04: CDR ;
05: SWAP ;
06: CAR ;
07: IF_LEFT
08: { DROP ; CDR ; PUSH int 0 ; PAIR ; NIL operation }
09: { DUP ;
10: PUSH nat 1 ;
11: COMPARE ;
12: LT ;
13: IF { SWAP ;
14: DUP ;
15: CDR ;
16: SWAP ;
17: CAR ;
18: PUSH int 1 ;
19: ADD ;
20: PAIR ;
21: SWAP ;
22: PUSH nat 0 ;
23: PUSH nat 2 ;
24: DIG 2 ;
25: DUP ;
26: DUG 3 ;
27: EDIV ;
28: IF_SOME { CDR } { PUSH int 39 ; FAILWITH } ;
29: COMPARE ;
30: EQ ;
31: IF { NIL operation ;
32: DIG 2 ;
33: DUP ;
34: DUG 3 ;
35: CDAR ;
36: CONTRACT %run (pair (contract %k nat) (nat %x)) ;
37: IF_SOME {} { PUSH int 31 ; FAILWITH } ;
38: PUSH mutez 0 ;
39: DIG 3 ;
40: SELF ;
41: ADDRESS ;
42: CONTRACT %run nat ;
43: IF_SOME {} { PUSH int 33 ; FAILWITH } ;
44: PAIR %k %x ;
45: TRANSFER_TOKENS ;
46: CONS }
47: { NIL operation ;
48: DIG 2 ;
49: DUP ;
50: DUG 3 ;
51: CDDR ;
52: CONTRACT %run (pair (contract %k nat) (nat %x)) ;
53: IF_SOME {} { PUSH int 32 ; FAILWITH } ;
54: PUSH mutez 0 ;
55: DIG 3 ;
56: SELF ;
57: ADDRESS ;
58: CONTRACT %run nat ;
59: IF_SOME {} { PUSH int 33 ; FAILWITH } ;
60: PAIR %k %x ;
61: TRANSFER_TOKENS ;
62: CONS } }
63: { DROP ; NIL operation } } ;
64: PAIR } }
At line 37 characters 50 to 58,
script reached FAILWITH instruction
with 31
Fatal error:
transfer simulation failed
Traceback (most recent call last):
File "test_collatz.py", line 68, in <module>
scenario_basic_call()
File "test_collatz.py", line 62, in scenario_basic_call
'--arg', '42'])
File "/Users/dariuscognac/Documents/GitHub/tezos/tests_python/client/client.py", line 384, in transfer
res = self.run(cmd)
File "/Users/dariuscognac/Documents/GitHub/tezos/tests_python/client/client.py", line 164, in run
(stdout, _, _) = self.run_generic(params, admin, check, trace)
File "/Users/dariuscognac/Documents/GitHub/tezos/tests_python/client/client.py", line 153, in run_generic
completed_process.check_returncode()
File "/Users/dariuscognac/anaconda3/lib/python3.7/subprocess.py", line 409, in check_returncode
self.stderr)
subprocess.CalledProcessError: Command '['/Users/dariuscognac/Documents/GitHub/tezos/tezos-client', '-base-dir', '/var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/tezos-client.ua4dn6on', '-endpoint', 'http://localhost:18730', 'transfer', '0', 'from', 'bootstrap1', 'to', 'main_contract', '--entrypoint', 'run', '--burn-cap', '9', '--arg', '42']' returned non-zero exit status 1.
(venv) $
Any suggestions on how to fix it would be greatly appreciated!
Collatz contracts in Michelson:
onEven contract: https://bit.ly/3l6nbqj
onOdd contract: https://bit.ly/3jn8Ghm
main Collatz contract https://bit.ly/33l6i5i
Python tezos-sandbox test script: https://bit.ly/2GrOgoU
and for reference the SmartPy script: https://bit.ly/3nej7pN