-
Notifications
You must be signed in to change notification settings - Fork 229
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
Unify usage of hasEnoughValidSignatures #354
Comments
I have done some quick tests on calling two variations of
From this results, seems that sending a blob is always a better approach in both, Istanbul and Constantinople hardforks. |
Cool! Thanks for rapid testing! So, let's change |
In my understanding, there won't be any vulnerability. Am I correct? |
Thanks for analysis. So the next step is to migrate to the new approach to pass signatures. |
As part of work under AMB feature a new way to transmit signatures was suggested and implemented as the alternative implementation of
hasEnoughValidSignatures
:https://github.com/poanetwork/tokenbridge-contracts/blob/c85aeb737bfd684b20b99520bd632ba4b8866583/contracts/libraries/Message.sol#L124-L157
The reason of the suggestion is to achieve more cheaper transactions for the validators: instead of sending arrays
_vs
,_rs
and_ss
of the same size the signatures are transferred as a blob which consumes less gas for sending but could require more gas for handling. Tests showed that the high gas cost for nonzero bytes in the calldata (68
gas) makes the new implementation more effective from gas usage point of view.The EIP-2028 in the Istanbul hardfork reduces the cost of calldata from 68 to 16 gas per non-zero byte. It means that we need to re-examine if the new implementation is still effective for different number of signatures required for full confirmation. If it is still effective it is necessary to change the
executeSignatures
method inBasicForeignBridge
as so the new implementation is used.The text was updated successfully, but these errors were encountered: