Skip to content

Instantly share code, notes, and snippets.

@Aimeedeer
Last active January 19, 2021 00:02
Show Gist options
  • Save Aimeedeer/a902bc4f3bbd051cd48f614f2625e86d to your computer and use it in GitHub Desktop.
Save Aimeedeer/a902bc4f3bbd051cd48f614f2625e86d to your computer and use it in GitHub Desktop.
Debug ink contract
2021-01-08 16:35:54.010 DEBUG tokio-runtime-worker runtime:DispatchError
2021-01-08 16:35:54.010 DEBUG tokio-runtime-worker runtime:8
2021-01-08 16:35:54.010 DEBUG tokio-runtime-worker runtime:6
2021-01-08 16:35:54.010 DEBUG tokio-runtime-worker runtime:OutOfGas
2021-01-08 16:35:54.010 DEBUG tokio-runtime-worker runtime:PostInfo:
2021-01-08 16:35:54.010 DEBUG tokio-runtime-worker runtime:actual_weight=
2021-01-08 16:35:54.010 DEBUG tokio-runtime-worker runtime:5000000000
2021-01-08 16:35:54.010 DEBUG tokio-runtime-worker runtime:pays_fee=
2021-01-08 16:35:54.010 DEBUG tokio-runtime-worker runtime:Yes
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:dispatch_level: hash: AccountId([76, 250, 199, 247, 76, 98, 51, 68, 155, 94, 84, 186, 7, 2, 49, 221, 148, 199, 27, 137, 80, 84, 130, 205, 145, 0, 0, 101, 98, 88, 211, 237])
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:DispatchError
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:8
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:17
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:ContractTrapped
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:PostInfo:
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:actual_weight=
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:7687334381
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:pays_fee=
2021-01-08 16:36:12.009 DEBUG tokio-runtime-worker runtime:Yes
@Aimeedeer
Copy link
Author

2021-01-16 15:45:30.011 DEBUG tokio-runtime-worker runtime:DispatchError
2021-01-16 15:45:30.011 DEBUG tokio-runtime-worker runtime:8
2021-01-16 15:45:30.011 DEBUG tokio-runtime-worker runtime:17
2021-01-16 15:45:30.011 DEBUG tokio-runtime-worker runtime:ContractTrapped
2021-01-16 15:45:30.011 DEBUG tokio-runtime-worker runtime:PostInfo:
2021-01-16 15:45:30.011 DEBUG tokio-runtime-worker runtime:actual_weight=
2021-01-16 15:45:30.011 DEBUG tokio-runtime-worker runtime:17838535710
2021-01-16 15:45:30.011 DEBUG tokio-runtime-worker runtime:pays_fee=
2021-01-16 15:45:30.011 DEBUG tokio-runtime-worker runtime:Yes
2021-01-16 15:45:42.003 DEBUG tokio-runtime-worker runtime:DispatchError
2021-01-16 15:45:42.003 DEBUG tokio-runtime-worker runtime:8
2021-01-16 15:45:42.003 DEBUG tokio-runtime-worker runtime:6
2021-01-16 15:45:42.003 DEBUG tokio-runtime-worker runtime:OutOfGas
2021-01-16 15:45:42.003 DEBUG tokio-runtime-worker runtime:PostInfo:
2021-01-16 15:45:42.003 DEBUG tokio-runtime-worker runtime:actual_weight=
2021-01-16 15:45:42.003 DEBUG tokio-runtime-worker runtime:4000000000
2021-01-16 15:45:42.003 DEBUG tokio-runtime-worker runtime:pays_fee=
2021-01-16 15:45:42.003 DEBUG tokio-runtime-worker runtime:Yes

@Aimeedeer
Copy link
Author

Aimeedeer commented Jan 16, 2021

2021-01-16 16:47:54.008  DEBUG tokio-runtime-worker runtime:calling get on AccountId([204, 247, 141, 155, 105, 133, 37, 166, 100, 25, 135, 25, 25, 193, 37, 177, 98, 135, 144, 120, 35, 121, 201, 67, 115, 143, 119, 234, 149, 91, 55, 236])    
2021-01-16 16:47:54.009  DEBUG tokio-runtime-worker runtime:return value Err(Decode(Error))    

Because of return errors:

            let return_value = build_call::<DefaultEnvironment>()
                .callee(program_id)
                .gas_limit(20035585459)
                .transferred_value(0)
                .exec_input(
                    ExecutionInput::new(Selector::new([0xDE, 0xAD, 0xBE, 0xFF]))
                )
                .returns::<ReturnType<bool>>()
                .fire();
                //.unwrap();                                                                                                                                  

            ink_env::debug_println(&format!("return value {:?}", return_value));

@Aimeedeer
Copy link
Author

$ canvas --dev --tmp -lerror,runtime=debug
2021-01-18 17:58:47.306  DEBUG event.loop0 runtime:game account: PlayerAccount { level: 0, level_contracts: {0: AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])} }    
2021-01-18 17:58:47.308  DEBUG event.loop0 runtime:program id: AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])    
2021-01-18 17:58:47.309  DEBUG event.loop0 runtime:calling flip on AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])    
2021-01-18 17:58:47.311  DEBUG event.loop0 runtime:calling get on AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])    
2021-01-18 17:58:47.312  DEBUG event.loop0 runtime:get method call success    
2021-01-18 17:58:47.312  DEBUG event.loop0 runtime:get return value true    
2021-01-18 17:58:47.317  DEBUG event.loop0 runtime:game account: PlayerAccount { level: 0, level_contracts: {0: AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])} }    
2021-01-18 17:58:47.318  DEBUG event.loop0 runtime:program id: AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])    
2021-01-18 17:58:47.320  DEBUG event.loop0 runtime:calling flip on AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])    
2021-01-18 17:58:47.321  DEBUG event.loop0 runtime:calling get on AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])    
2021-01-18 17:58:47.322  DEBUG event.loop0 runtime:get method call success    
2021-01-18 17:58:47.322  DEBUG event.loop0 runtime:get return value true    
2021-01-18 17:59:06.008  DEBUG tokio-runtime-worker runtime:game account: PlayerAccount { level: 0, level_contracts: {0: AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])} }    
2021-01-18 17:59:06.009  DEBUG tokio-runtime-worker runtime:program id: AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])    
2021-01-18 17:59:06.010  DEBUG tokio-runtime-worker runtime:calling flip on AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])    
2021-01-18 17:59:06.012  DEBUG tokio-runtime-worker runtime:calling get on AccountId([143, 23, 140, 104, 129, 87, 181, 199, 82, 222, 77, 198, 172, 231, 178, 249, 251, 156, 129, 233, 134, 167, 114, 60, 101, 73, 245, 85, 139, 84, 27, 156])    
2021-01-18 17:59:06.012  DEBUG tokio-runtime-worker runtime:get method call success    
2021-01-18 17:59:06.012  DEBUG tokio-runtime-worker runtime:get return value true    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment