Skip to content
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

Re-read required message length when the length check failed #74

Open
akolotov opened this issue Aug 30, 2018 · 1 comment
Open

Re-read required message length when the length check failed #74

akolotov opened this issue Aug 30, 2018 · 1 comment
Assignees
Labels

Comments

@akolotov
Copy link
Collaborator

As per changes delivered under #67 it was introduced that the bridge contracts data are used to get required length of the message. The implemented logic assumes that the length is accessed only once when the bridge is being run. And for the case when the bridge contracts are upgraded as so the required length of the message is being changed, all bridge instances needs to be re-run.

Sometimes it is hard to manage restart of several independent application instances, so it will be useful to have an ability to re-read the length without the bridge re-initialization.

One of possible approach is to re-read the length every time when new message is being prepared. But it will introduce huge amount of similar RPC calls and huge amount of the same responses. It could impact the bridge instance performance.

Another approach was described here #67 (comment) and it was agreed that it could be implemented as soon as the work for #24 is finished.

@fvictorio fvictorio self-assigned this Oct 17, 2018
@fvictorio
Copy link

fvictorio commented Oct 17, 2018

The problem with the second approach is that the assert will continue to pass: the contract may have changed the required length, but the code is the same. If the code was modified, then the bridge had to be restarted, and re-reading the variable is not necessary.

An alternative approach is this: in the estimateGas function, after all the checks we already have, we add one more checking if the required message length in the contract is different than the one we have. If it is, we throw an error indicating that, and use it to update the variable.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants