-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Allow Native Contracts to be updated #2942
Merged
Merged
Changes from 40 commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
24b181f
Update manifest
shargon 3c6a1f0
Fix comment
shargon a5772bc
Format & fix methods
shargon 95335e0
Fix new
shargon 7ae51e1
Initialize storage fixes
shargon 22d72b5
Fix IsInitializeBlock
shargon c7602c6
Fix update
shargon b573a00
Fix GetContractState
shargon 3adddd2
Optimize
shargon 984d3d7
Fix first invoke without sync
shargon 6341bad
Remove current methods
shargon 4f59c43
Clean usings
shargon c85a1cc
Improve reading Initialize
shargon 2490280
Clean OnManifestCompose
shargon 47317ee
Use cache for all native contracts
shargon 8fd8fc2
Fix ut
shargon 7ba6274
Move cache to ApplicationEngine
shargon 67a9364
Clean code
shargon 8eb82db
Allow nullable attribute
shargon 8667047
Update src/Neo/SmartContract/Native/ContractEventAttribute.cs
Jim8y 5f41acf
Merge branch 'master' into update-native-contracts
Jim8y ed33b32
Add base call
shargon eea7324
Merge branch 'update-native-contracts' of https://github.com/neo-proj…
shargon 594c2e6
Fix one https://github.com/neo-project/neo/pull/2941#discussion_r1382…
shargon 64e5cfc
Fix IsInitializeBlock https://github.com/neo-project/neo/pull/2941#di…
shargon 1b210ce
Add ContractEventAttribute constructors for ActiveIn
shargon 5bb42d2
Merge branch 'master' into update-native-contracts
shargon 690b5d4
Ensure ommited hfs
shargon 8cef6ce
Rename
shargon f114982
Case insensitive hf config
shargon 4e27f15
Merge branch 'master' into update-native-contracts
Jim8y 1fee32f
Increase coverage
shargon 957a507
Merge branch 'update-native-contracts' of https://github.com/neo-proj…
shargon 06f1b23
More uts
shargon aee4be3
Rename
shargon c4b4a88
Update src/Neo/SmartContract/Native/ContractManagement.cs
shargon c5ebf3f
Merge branch 'master' into update-native-contracts
shargon 28ac4e6
format code
shargon ff852a3
Fix ProtocolSettings
shargon f2586ed
Merge branch 'master' into update-native-contracts
shargon 53e15b3
Merge branch 'master' into update-native-contracts
shargon 8b4d596
Merge branch 'master' into update-native-contracts
shargon 405a816
Update src/Neo/SmartContract/ApplicationEngine.cs
shargon 4f9739d
Merge branch 'master' into update-native-contracts
shargon d621476
format
shargon 4ade232
reorder using
shargon baa7807
Merge branch 'master' into update-native-contracts
Jim8y 487f4ac
Fix UT
shargon 963c557
Merge branch 'master' into update-native-contracts
shargon 8c9e0c6
Adding keccak256 (#2925)
Jim8y 7a8bb33
Merge branch 'master' into update-native-contracts
Jim8y d45fc30
Merge branch 'master' into update-native-contracts
shargon c7f0209
Merge branch 'master' into update-native-contracts
shargon 6b0916d
Merge branch 'master' into update-native-contracts
shargon c13575c
Fix net standard
shargon 5940271
Merge branch 'master' into update-native-contracts
Jim8y 48d2349
Merge branch 'master' into update-native-contracts
shargon 41914d8
Add ut
shargon e87e2b2
Fix update
shargon 447583f
Merge branch 'master' into update-native-contracts
shargon d00f510
Merge branch 'master' into update-native-contracts
shargon 8bcda87
Fix update
shargon 40c5d97
Merge branch 'master' into update-native-contracts
shargon ef43618
Merge branch 'master' into update-native-contracts
shargon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
// Copyright (C) 2015-2023 The Neo Project. | ||
// | ||
// The neo is free software distributed under the MIT software license, | ||
// see the accompanying file LICENSE in the main directory of the | ||
// project or http://www.opensource.org/licenses/mit-license.php | ||
// for more details. | ||
// | ||
// Redistribution and use in source and binary forms with or without | ||
// modifications are permitted. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using Neo.SmartContract.Manifest; | ||
|
||
namespace Neo.SmartContract.Native | ||
{ | ||
[DebuggerDisplay("{Descriptor.Name}")] | ||
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = true)] | ||
internal class ContractEventAttribute : Attribute | ||
{ | ||
public int Order { get; init; } | ||
public ContractEventDescriptor Descriptor { get; set; } | ||
public Hardfork? ActiveIn { get; init; } = null; | ||
|
||
public ContractEventAttribute(Hardfork activeIn, int order, string name, | ||
string arg1Name, ContractParameterType arg1Value) : this(order, name, arg1Name, arg1Value) | ||
{ | ||
ActiveIn = activeIn; | ||
} | ||
|
||
public ContractEventAttribute(int order, string name, string arg1Name, ContractParameterType arg1Value) | ||
{ | ||
Order = order; | ||
Descriptor = new ContractEventDescriptor() | ||
{ | ||
Name = name, | ||
Parameters = new ContractParameterDefinition[] | ||
{ | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg1Name, | ||
Type = arg1Value | ||
} | ||
} | ||
}; | ||
} | ||
|
||
public ContractEventAttribute(Hardfork activeIn, int order, string name, | ||
string arg1Name, ContractParameterType arg1Value, | ||
string arg2Name, ContractParameterType arg2Value) : this(order, name, arg1Name, arg1Value, arg2Name, arg2Value) | ||
{ | ||
ActiveIn = activeIn; | ||
} | ||
|
||
public ContractEventAttribute(int order, string name, | ||
string arg1Name, ContractParameterType arg1Value, | ||
string arg2Name, ContractParameterType arg2Value) | ||
{ | ||
Order = order; | ||
Descriptor = new ContractEventDescriptor() | ||
{ | ||
Name = name, | ||
Parameters = new ContractParameterDefinition[] | ||
{ | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg1Name, | ||
Type = arg1Value | ||
}, | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg2Name, | ||
Type = arg2Value | ||
} | ||
} | ||
}; | ||
} | ||
|
||
public ContractEventAttribute(Hardfork activeIn, int order, string name, | ||
string arg1Name, ContractParameterType arg1Value, | ||
string arg2Name, ContractParameterType arg2Value, | ||
string arg3Name, ContractParameterType arg3Value) : this(order, name, arg1Name, arg1Value, arg2Name, arg2Value, arg3Name, arg3Value) | ||
{ | ||
ActiveIn = activeIn; | ||
} | ||
|
||
public ContractEventAttribute(int order, string name, | ||
string arg1Name, ContractParameterType arg1Value, | ||
string arg2Name, ContractParameterType arg2Value, | ||
string arg3Name, ContractParameterType arg3Value | ||
) | ||
{ | ||
Order = order; | ||
Descriptor = new ContractEventDescriptor() | ||
{ | ||
Name = name, | ||
Parameters = new ContractParameterDefinition[] | ||
{ | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg1Name, | ||
Type = arg1Value | ||
}, | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg2Name, | ||
Type = arg2Value | ||
}, | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg3Name, | ||
Type = arg3Value | ||
} | ||
} | ||
}; | ||
} | ||
|
||
public ContractEventAttribute(Hardfork activeIn, int order, string name, | ||
string arg1Name, ContractParameterType arg1Value, | ||
string arg2Name, ContractParameterType arg2Value, | ||
string arg3Name, ContractParameterType arg3Value, | ||
string arg4Name, ContractParameterType arg4Value) : this(order, name, arg1Name, arg1Value, arg2Name, arg2Value, arg3Name, arg3Value, arg4Name, arg4Value) | ||
{ | ||
ActiveIn = activeIn; | ||
} | ||
|
||
public ContractEventAttribute(int order, string name, | ||
string arg1Name, ContractParameterType arg1Value, | ||
string arg2Name, ContractParameterType arg2Value, | ||
string arg3Name, ContractParameterType arg3Value, | ||
string arg4Name, ContractParameterType arg4Value | ||
) | ||
{ | ||
Order = order; | ||
Descriptor = new ContractEventDescriptor() | ||
{ | ||
Name = name, | ||
Parameters = new ContractParameterDefinition[] | ||
{ | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg1Name, | ||
Type = arg1Value | ||
}, | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg2Name, | ||
Type = arg2Value | ||
}, | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg3Name, | ||
Type = arg3Value | ||
}, | ||
new ContractParameterDefinition() | ||
{ | ||
Name = arg4Name, | ||
Type = arg4Value | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For compatibility reasons, explicitly set the height of HF_Aspidochelone and HF_Basilisk hardforks to 0 for proper IsHardforkEnabled behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe directly explain that, because this will be just for these two, right?