aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Move] Ban `public entry` functions that accept structs as arguments

Open banool opened this issue 3 years ago • 2 comments
trafficstars

🚀 Feature Request

Currently this move module compiles:

$ cat mytest/sources/MyTest.move
module MyModule::MyTest {
    struct MyTest has key {}

    struct Vote has copy, drop, store {
        blah: u8,
    }

    public(script) fun vote(_voter: &signer, _vote: Vote) {}
}

$ aptos move compile --package-dir mytest
{
  "Result": [
    "C40F1C9B9FDC204CF77F68C9BB7029B0ABBE8AD9E5561F7794964076A4FBDCFD::MyTest"
  ]
}

However, this function vote, which is intended to be called from a client, can never actually be called because it is impossible to pass in a Vote to the function. We should make this a compile time warning / error.

There will need to be an exception for structs that we explicitly allow (referring to https://github.com/aptos-labs/aptos-core/pull/1869).

banool avatar Jul 11 '22 20:07 banool

This has popped up again on Discord.

banool avatar Aug 19 '22 14:08 banool

It is on my todo list.

wrwg avatar Aug 19 '22 21:08 wrwg

This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.

github-actions[bot] avatar Nov 07 '22 06:11 github-actions[bot]

This is already banned since a while.

wrwg avatar Nov 07 '22 16:11 wrwg