mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2026-03-01 04:28:51 +00:00
Do not generate conversion code for event parameter those type doesn't match the one provided in the contract config #1137
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#1137
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 @AnnaShaleva on GitHub (May 31, 2023).
See https://github.com/nspcc-dev/neo-go/pull/3008#discussion_r1209546459.
@AnnaShaleva commented on GitHub (May 31, 2023):
Within the scope of this issue we also need to add
RealTypecomparison for the set of emitted events if--guessed-evettypesoption is used.@AnnaShaleva commented on GitHub (May 31, 2023):
@roman-khimov, I did some digging and I still doubt that we need this issue to be implemented. Initially there was a requirement of enforced type casting for events parameters: https://github.com/nspcc-dev/neo-go/issues/2713. The issue was inspired by ABI match requirement for emitted notifications.
Back to our discussion:
It's a contraversal statement. IMO, the user that calls
runtime.Notify("Name", 5)and writesByteArrayin the contract config would probably expect the unchanged binary representation of 5, not the string.I'd suggest to consider another solution of this problem: we may stil emit conversion code for such cases and store the real type of the parameter. During events check we can warn a user about events mismatch in some compilation log. If it is done intentionally, then OK, the result will be converted. If not, then the user will fix either the contract config or the code.
@AnnaShaleva commented on GitHub (Nov 12, 2025):
Within the scope of this issue we need to deal with this test:
nspcc-dev/neo-go@e22e2a1fbe/cli/smartcontract/generate_test.go (L639-L648)