aptos-core
aptos-core copied to clipboard
[Move] Ban `public entry` functions that accept structs as arguments
🚀 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).
This has popped up again on Discord.
It is on my todo list.
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.
This is already banned since a while.