Skip to content

Commit

Permalink
Merge branch 'HF_Echidna' of github.com:neo-project/neo into HF_Echidna
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Neo/Neo.csproj
#	src/Neo/SmartContract/Native/RoleManagement.cs
  • Loading branch information
Jim8y committed Nov 6, 2024
2 parents 7dba130 + 620d938 commit 0457ccd
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/Neo/SmartContract/Native/RoleManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@ public sealed class RoleManagement : NativeContract
{
[ContractEvent(0, name: "Designation",
"Role", ContractParameterType.Integer,
"BlockIndex", ContractParameterType.Integer,
Hardfork.HF_Echidna)]

[ContractEvent(Hardfork.HF_Echidna, 0, name: "Designation",
"Role", ContractParameterType.Integer,
"BlockIndex", ContractParameterType.Integer,
"Old", ContractParameterType.Array,
"New", ContractParameterType.Array
)]

"BlockIndex", ContractParameterType.Integer)]
internal RoleManagement() : base() { }

/// <summary>
Expand Down Expand Up @@ -78,18 +69,7 @@ private void DesignateAsRole(ApplicationEngine engine, Role role, ECPoint[] node
list.AddRange(nodes);
list.Sort();
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 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]));
}
else
{
engine.SendNotification(Hash, "Designation", new VM.Types.Array(engine.ReferenceCounter, [(int)role, engine.PersistingBlock.Index]));
}
engine.SendNotification(Hash, "Designation", new VM.Types.Array(engine.ReferenceCounter, new StackItem[] { (int)role, engine.PersistingBlock.Index }));
}

private class NodeList : InteroperableList<ECPoint>
Expand Down

0 comments on commit 0457ccd

Please sign in to comment.