add dynamic callstack for prevent the re-entrancy attack
add max call depth limitation
about integration test,
cannot make the test logic with multiple contracts in the cosmwasm repo.
So I tested manually via try_reentrancy msg of dynamic_caller_contract.
Reentry is well blocked like this(A->B->A):
{"height":"7","txhash":"066247EDDA6EB99AD88027D3B4B22A67434EBDC65CC87D7BB00E156A1D5865B9","codespace":"wasm","code":5,"data":"","raw_log":"failed to execute message; message index: 0: Error calling the VM: Error executing Wasm: Wasmer runtime error: RuntimeError: func_info:{module_name:dynamic_callee_contract, name:stub_reentrancy, signature:[I32] -\u003e []}, error:Unknown error during call into backend: Some(\"Error executing Wasm: Wasmer runtime error: RuntimeError: func_info:{module_name:dynamic_caller_contract, name:stub_should_never_be_called, signature:[] -\u003e []}, error:User error during call into backend: A contract can only be called once per message.\"): execute wasm contract failed","logs":[],"info":"","gas_wanted":"200000","gas_used":"67989","tx":null,"timestamp":""}
In order to put the above integration tests structurally into code, it need to go into lbm's cli_test.
So This will be done after merging into main in the future.
Types of changes
[ ] Bug fix (changes which fixes an issue)
[x] New feature (changes which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Description
Closes #155 https://github.com/line/wasmvm/pull/62
about integration test, cannot make the test logic with multiple contracts in the cosmwasm repo. So I tested manually via
try_reentrancy
msg ofdynamic_caller_contract
. Reentry is well blocked like this(A->B->A):In order to put the above integration tests structurally into code, it need to go into lbm's
cli_test
. So This will be done after merging into main in the future.Types of changes
Checklist