Skip to content

Commit

Permalink
Fix HF_Echidna comments (#3679)
Browse files Browse the repository at this point in the history
* Fix obsolete

* Fix https://github.com/neo-project/neo/pull/3454/files#r1912152270

* Fix comment

* Update RoleManagement.cs

* Unset HF_Echidna

* Revert getTransaction

* Revert verifyWithECDsa
  • Loading branch information
shargon authored Jan 21, 2025
1 parent a4e6cf1 commit d685be8
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 15 deletions.
3 changes: 1 addition & 2 deletions src/Neo.CLI/config.fs.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"HF_Aspidochelone": 3000000,
"HF_Basilisk": 4500000,
"HF_Cockatrice": 5800000,
"HF_Domovoi": 5800000,
"HF_Echidna": 5800001
"HF_Domovoi": 5800000
},
"StandbyCommittee": [
"026fa34ec057d74c2fdf1a18e336d0bd597ea401a0b2ad57340d5c220d09f44086",
Expand Down
3 changes: 1 addition & 2 deletions src/Neo.CLI/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"HF_Aspidochelone": 1730000,
"HF_Basilisk": 4120000,
"HF_Cockatrice": 5450000,
"HF_Domovoi": 5570000,
"HF_Echidna": 5570001
"HF_Domovoi": 5570000
},
"InitialGasDistribution": 5200000000000000,
"ValidatorsCount": 7,
Expand Down
3 changes: 1 addition & 2 deletions src/Neo.CLI/config.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"HF_Aspidochelone": 1730000,
"HF_Basilisk": 4120000,
"HF_Cockatrice": 5450000,
"HF_Domovoi": 5570000,
"HF_Echidna": 5570001
"HF_Domovoi": 5570000
},
"InitialGasDistribution": 5200000000000000,
"ValidatorsCount": 7,
Expand Down
3 changes: 1 addition & 2 deletions src/Neo.CLI/config.testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"HF_Aspidochelone": 210000,
"HF_Basilisk": 2680000,
"HF_Cockatrice": 3967000,
"HF_Domovoi": 4144000,
"HF_Echidna": 4144001
"HF_Domovoi": 4144000
},
"InitialGasDistribution": 5200000000000000,
"ValidatorsCount": 7,
Expand Down
2 changes: 1 addition & 1 deletion src/Neo/Cryptography/Ed25519.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Ed25519.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
3 changes: 1 addition & 2 deletions src/Neo/ProtocolSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,11 @@ public record ProtocolSettings
/// <returns>Full path of the file if found, null otherwise.</returns>
public static string FindFile(string fileName, string path)
{

// Check if the given path is relative
if (!Path.IsPathRooted(path))
{
// Combine with the executable directory if relative
var executablePath = AppDomain.CurrentDomain.BaseDirectory;
var executablePath = AppContext.BaseDirectory;
path = Path.Combine(executablePath, path);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Neo/SmartContract/Native/CryptoLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static bool VerifyWithECDsa(byte[] message, byte[] pubkey, byte[] signatu
}

// This is for solving the hardfork issue in https://github.com/neo-project/neo/pull/3209
[ContractMethod(true, Hardfork.HF_Cockatrice, CpuFee = 1 << 15, Name = nameof(VerifyWithECDsa))]
[ContractMethod(true, Hardfork.HF_Cockatrice, CpuFee = 1 << 15, Name = "verifyWithECDsa")]
public static bool VerifyWithECDsaV0(byte[] message, byte[] pubkey, byte[] signature, NamedCurveHash curve)
{
if (curve != NamedCurveHash.secp256k1SHA256 && curve != NamedCurveHash.secp256r1SHA256)
Expand Down
2 changes: 1 addition & 1 deletion src/Neo/SmartContract/Native/LedgerContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public Transaction GetTransaction(DataCache snapshot, UInt256 hash)
return GetTransactionState(snapshot, hash)?.Transaction;
}

[ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.ReadStates, Name = nameof(GetTransaction))]
[ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.ReadStates, Name = "getTransaction")]
private Transaction GetTransactionForContract(ApplicationEngine engine, UInt256 hash)
{
TransactionState state = GetTransactionState(engine.SnapshotCache, hash);
Expand Down
3 changes: 1 addition & 2 deletions src/Neo/SmartContract/Native/RoleManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public ECPoint[] GetDesignatedByRole(DataCache snapshot, Role role, uint index)
}

[ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.States | CallFlags.AllowNotify)]
[Obsolete]
private void DesignateAsRole(ApplicationEngine engine, Role role, ECPoint[] nodes)
{
if (nodes.Length == 0 || nodes.Length > 32)
Expand All @@ -81,7 +80,7 @@ private void DesignateAsRole(ApplicationEngine engine, Role role, ECPoint[] node
engine.SnapshotCache.Add(key, new StorageItem(list));
if (engine.IsHardforkEnabled(Hardfork.HF_Echidna))
{
var oldNodes = new VM.Types.Array(engine.ReferenceCounter, GetDesignatedByRole(engine.Snapshot, role, index - 1).Select(u => (ByteString)u.EncodePoint(true)));
var oldNodes = new VM.Types.Array(engine.ReferenceCounter, GetDesignatedByRole(engine.SnapshotCache, role, index - 1).Select(u => (ByteString)u.EncodePoint(true)));
var newNodes = new VM.Types.Array(engine.ReferenceCounter, nodes.Select(u => (ByteString)u.EncodePoint(true)));

engine.SendNotification(Hash, "Designation", new VM.Types.Array(engine.ReferenceCounter, [(int)role, engine.PersistingBlock.Index, oldNodes, newNodes]));
Expand Down

0 comments on commit d685be8

Please sign in to comment.