-
Notifications
You must be signed in to change notification settings - Fork 19
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
V3.1 audit fixes #255
V3.1 audit fixes #255
Conversation
Coverage SummaryTotals
FilesExpand
|
Contract comparison - from 7eb68ea to fdcecd4
|
bridge-proxy: refund refactor
The base branch was changed.
…fter-refund bridge-proxy: Clear storages after refund
bridge-proxy/src/bridge-proxy.rs
Outdated
|
||
if call_data.endpoint.is_empty() | ||
let non_empty_args = call_data.args.is_some(); | ||
if (call_data.endpoint.is_empty() && non_empty_args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrote an integration test for this. Apparently, if I send this RAW SC call data 000000000000000002faf08000
(empty function and 50 mil gas limit) it does not refund the transfer. Good catch @dragos-rebegea
eth_tx.tx_nonce, | ||
); | ||
// emit events only for non-SC destinations | ||
if self.blockchain().is_smart_contract(ð_tx.to) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To solve what @dragos-rebegea mentioned and fix the audit finding #9, do you think it would be better to do the following:
- emit the event only if the destination address is not a SC
- remove the
transfer_performed_sc_event
and instead emit thetransfer_performed_event
in the bridge proxy if the call to the SC succeeded
multi_transfer_esdt_proxy, | ||
}; | ||
|
||
const MAX_BOARD_MEMBERS: usize = 40; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 40? I would go to a higher value like 100 or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fix for issue 4 from the Audit document.
We iterate over all board signatures and the call may run out of gas.
Maybe an integration test from your side could help us adjust this value.
multisig/src/setup.rs
Outdated
|
||
#[only_owner] | ||
#[payable("*")] | ||
#[endpoint(bridgedTokensWrapperDepositLiquidity)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this? The owner of the wrapper is not the multisig contract
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
multisig/src/lib.rs
Outdated
|
||
let action_ids_mapper = self.batch_id_to_action_id_mapping(eth_batch_id); | ||
|
||
for act_id in action_ids_mapper.values() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should take max values here also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
transaction_details.refund_info.initial_nonce, | ||
); | ||
} | ||
let transaction_details = self.create_transaction_common(to, OptionalValue::None); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require call from bridge proxy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added + unit test.
multi-transfer-esdt/src/lib.rs
Outdated
refund_tx_list.push(refund_tx); | ||
self.token_with_transfer_role(eth_tx.token_id); | ||
// let refund_tx = self.convert_to_refund_tx(eth_tx.clone()); | ||
// refund_tx_list.push(refund_tx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
bridged-tokens-wrapper/src/lib.rs
Outdated
@@ -135,10 +134,18 @@ pub trait BridgedTokensWrapper: | |||
self.token_decimals_num(&chain_specific_token_id).clear(); | |||
} | |||
|
|||
#[only_owner] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still present
Reference PR: multiversx/mx-bridge-eth-go#389