Skip to content

Add Hardfork for StrictMode #2881

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Neo/Hardfork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Neo
{
public enum Hardfork : byte
{
HF_Aspidochelone
HF_Aspidochelone,
HF_Basilisk
}
}
2 changes: 1 addition & 1 deletion src/Neo/SmartContract/ApplicationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public void SetState<T>(T state)
states[typeof(T)] = state;
}

private bool IsHardforkEnabled(Hardfork hardfork)
public bool IsHardforkEnabled(Hardfork hardfork)
{
if (PersistingBlock is null)
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/Neo/SmartContract/Native/ContractManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private async ContractTask<ContractState> Deploy(ApplicationEngine engine, byte[

NefFile nef = nefFile.AsSerializable<NefFile>();
ContractManifest parsedManifest = ContractManifest.Parse(manifest);
Helper.Check(new VM.Script(nef.Script, true), parsedManifest.Abi);
Helper.Check(new VM.Script(nef.Script, engine.IsHardforkEnabled(Hardfork.HF_Basilisk)), parsedManifest.Abi);
UInt160 hash = Helper.GetContractHash(tx.Sender, nef.CheckSum, parsedManifest.Name);

if (Policy.IsBlocked(engine.Snapshot, hash))
Expand Down Expand Up @@ -295,7 +295,7 @@ private ContractTask Update(ApplicationEngine engine, byte[] nefFile, byte[] man
throw new InvalidOperationException($"Invalid Manifest Hash: {contract.Hash}");
contract.Manifest = manifest_new;
}
Helper.Check(new VM.Script(contract.Nef.Script, true), contract.Manifest.Abi);
Helper.Check(new VM.Script(contract.Nef.Script, engine.IsHardforkEnabled(Hardfork.HF_Basilisk)), contract.Manifest.Abi);
contract.UpdateCounter++; // Increase update counter
return OnDeploy(engine, contract, data, true);
}
Expand Down