Unverified Commit 57558021 authored by Sasha Gryaznov's avatar Sasha Gryaznov Committed by GitHub
Browse files

Allow reentrancy for multisig example contract (#1360)



* allow reentrancy

* make allow_reentry the parameter of the Transaction

* Update examples/multisig/lib.rs
Co-authored-by: Alexander Theißen's avatarAlexander Theißen <alex.theissen@me.com>

* re-entrancy vulnerabilities note

* ci fixes
Co-authored-by: Alexander Theißen's avatarAlexander Theißen <alex.theissen@me.com>
parent bb4104ec
Pipeline #212677 passed with stages
in 20 minutes and 18 seconds
......@@ -64,10 +64,13 @@ use ink_lang as ink;
#[ink::contract]
mod multisig {
use ink_env::call::{
build_call,
Call,
ExecutionInput,
use ink_env::{
call::{
build_call,
Call,
ExecutionInput,
},
CallFlags,
};
use ink_prelude::vec::Vec;
use ink_storage::{
......@@ -135,6 +138,9 @@ mod multisig {
pub transferred_value: Balance,
/// Gas limit for the execution of the call.
pub gas_limit: u64,
/// If set to true the transaction will be allowed to re-enter the multisig contract.
/// Re-entrancy can lead to vulnerabilities. Use at your own risk.
pub allow_reentry: bool,
}
/// Errors that can occur upon calling this contract.
......@@ -546,6 +552,7 @@ mod multisig {
.gas_limit(t.gas_limit)
.transferred_value(t.transferred_value),
)
.call_flags(CallFlags::default().set_allow_reentry(t.allow_reentry))
.exec_input(
ExecutionInput::new(t.selector.into()).push_arg(CallInput(&t.input)),
)
......@@ -578,6 +585,7 @@ mod multisig {
.gas_limit(t.gas_limit)
.transferred_value(t.transferred_value),
)
.call_flags(CallFlags::default().set_allow_reentry(t.allow_reentry))
.exec_input(
ExecutionInput::new(t.selector.into()).push_arg(CallInput(&t.input)),
)
......@@ -734,6 +742,7 @@ mod multisig {
input: call_args.encode(),
transferred_value: 0,
gas_limit: 1000000,
allow_reentry: false,
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment