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

Cannot identify the number of signers in adapter layer #209

Closed
areshand opened this issue Apr 11, 2022 · 5 comments
Closed

Cannot identify the number of signers in adapter layer #209

areshand opened this issue Apr 11, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@areshand
Copy link
Contributor

areshand commented Apr 11, 2022

🚀 Feature Request

Motivation

When trying to use the latest move, come across a problem.

We automatically add signer to the script function call if we find the function requires signers (here

fn create_signers_and_arguments(
). This checks happens at VM runtime. It has access to the loader, which can load the script or script function to read the script/script_function parameter to determine how many signers are needed. But this loader seems not exposed to adapter layer.

With the new move revision (https://github.com/diem/move/pull/175/files), to use the new execute_entry_function, it only take args, which could contains both signer and txn args. we need to determine the number of signers to add to args at adapter layer now. However, some script function requires one signer and some doesn’t (eg: create_account). since loader is not exposed in the adapter’s session, I currently don’t find a way to calculate the number of signer in script or script function from adapter. Any suggestions or workarounds?

Pitch

Need to expose either the loader to adapter layers or functions in session to help determine the number of signers in the the script function or script

@areshand areshand added the enhancement New feature or request label Apr 11, 2022
@areshand
Copy link
Contributor Author

Hi @tnowacki, could you please take a look at this issue?
do you have a recommendation on the right way to identify the number of signer in script / script function at adapter layer?

cc: @zekun000 @msmouse

@tnowacki
Copy link
Contributor

tnowacki commented Apr 11, 2022

I sort of anticipated issues like this, but not this issue exactly. I just added a new API in #197. You should be able to use the new load_function function in Session to

So for this particular problem, you should be able to make a session, call load function, and then find out how to manage signer arguments as needed

Keep in mind the VM no longer verifies the signature of script functions at all, so the signers can appear in any position. You can use

pub fn legacy_script_signature_checks(
to enforce the legacy rules

@areshand
Copy link
Contributor Author

Thank you for such detailed reply. Close the issue now.

@areshand
Copy link
Contributor Author

@tnowacki is there a way to provide a similar load_script function so that

@areshand areshand reopened this Apr 13, 2022
@areshand
Copy link
Contributor Author

@tnowacki Could there be a similar load_function for script to read the signature of the

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

No branches or pull requests

2 participants