mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2026-03-01 04:28:51 +00:00
Contract update with multiple _deploy() functions #1523
Labels
No labels
I1
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U3
U3
U4
blocked
bug
bug
cli
compiler
config
config
consensus
dependencies
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
neotest
network
oracle
performance
question
rpc
security
smartcontract
task
task
task
test
vm
wallet
windows
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neo-go#1523
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fyfyrchik on GitHub (May 19, 2025).
Context
As per https://github.com/nspcc-dev/neo-go/blob/master/docs/compiler.md#vm-api-interop-layer (bold is mine):
The logic is there from the time
_deploywas implemented, and it was expicitly discussed: https://github.com/nspcc-dev/neo-go/pull/1452#discussion_r498858279Since then, it was long forgotten (by me, the implementor) and has bitten my colleagues recently in a long debugging session.
Suggestion
I'd like to revisit that decision now:
init()in the linked discussion is flawed:_deploymakes sense for a contract, not for a package:dataargument is passed to all functions (no such problem forinit)_deployis useful because it uses storage and the storage schema is different for different contract, so usage of the same_deploy()from multiple packages is limitedAny examples of contracts where current behaviour is needed are welcome.
This change is not backwards compatible, but the compiler could emit warnings/error, so that no unexpected things happen.
@roman-khimov commented on GitHub (May 19, 2025):
This is very likely to break in other places as well (
init()), so I'd say it's not supported.That's easy to solve using regular Go packages, make a shared package with whatever you need to share, import it.
In some ways I can agree with that since it's an exported method effectively. Does it worth the change? Not sure. There are contracts we're not aware of that are written in Go and they can use and misuse it already.