-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Native Contracts to be updated (#2942)
* Update manifest * Fix comment * Format & fix methods * Fix new * Initialize storage fixes * Fix IsInitializeBlock * Fix update * Fix GetContractState * Optimize * Fix first invoke without sync * Remove current methods * Clean usings * Improve reading Initialize * Clean OnManifestCompose * Use cache for all native contracts * Fix ut * Move cache to ApplicationEngine * Clean code * Allow nullable attribute * Update src/Neo/SmartContract/Native/ContractEventAttribute.cs * Add base call * Fix one #2941 (comment) * Fix IsInitializeBlock #2941 (comment) * Add ContractEventAttribute constructors for ActiveIn * Ensure ommited hfs * Rename * Case insensitive hf config * Increase coverage * More uts * Rename * Update src/Neo/SmartContract/Native/ContractManagement.cs * format code * Fix ProtocolSettings * Update src/Neo/SmartContract/ApplicationEngine.cs * format * reorder using * Fix UT * Adding keccak256 (#2925) * Create codeql.yml * Keccak256 * Delete .github/workflows/codeql.yml * Update src/Neo/SmartContract/Native/CryptoLib.cs * add more keccak256 test cases as required * Create codeql.yml * Keccak256 * Delete .github/workflows/codeql.yml * Update src/Neo/SmartContract/Native/CryptoLib.cs * add more keccak256 test cases as required * HF_Manticore * Fix copyright * Create codeql.yml * Keccak256 * Delete .github/workflows/codeql.yml * Update src/Neo/SmartContract/Native/CryptoLib.cs * add more keccak256 test cases as required * Create codeql.yml * Keccak256 * Delete .github/workflows/codeql.yml * Update src/Neo/SmartContract/Native/CryptoLib.cs * add more keccak256 test cases as required * HF_Manticore * Fix copyright * HF_Manticore * Update CryptoLib.cs * Update CryptoLib.cs * Update UT_CryptoLib.cs * Apply suggestions from code review * clean usings --------- Co-authored-by: Shargon <shargon@gmail.com> * Fix net standard * Add ut * Fix update * Fix update --------- Co-authored-by: Jimmy <jinghui@wayne.edu>
- Loading branch information
Showing
27 changed files
with
949 additions
and
317 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ namespace Neo | |
public enum Hardfork : byte | ||
{ | ||
HF_Aspidochelone, | ||
HF_Basilisk | ||
HF_Basilisk, | ||
HF_Cockatrice | ||
} | ||
} |
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
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,165 @@ | ||
// Copyright (C) 2015-2024 The Neo Project. | ||
// | ||
// ContractEventAttribute.cs file belongs to the neo project and is free | ||
// software distributed under the MIT software license, see the | ||
// accompanying file LICENSE in the main directory of the | ||
// repository 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 Neo.SmartContract.Manifest; | ||
using System; | ||
using System.Diagnostics; | ||
|
||
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.