-
Couldn't load subscription status.
- Fork 1k
Isolate ApplicationEngine events #4016
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
Changes from 3 commits
e2541fb
057387a
d00f61e
3fc7141
5eb70c5
6f7d862
6a38a39
2144023
3bf4a80
ee182b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,15 +44,24 @@ public partial class ApplicationEngine : ExecutionEngine | |
| /// </summary> | ||
| public const long TestModeGas = 20_00000000; | ||
|
|
||
| public delegate void DelOnNotify(ApplicationEngine engine, NotifyEventArgs args); | ||
|
|
||
| /// <summary> | ||
| /// Triggered when a contract calls System.Runtime.Notify. | ||
| /// </summary> | ||
| public static event EventHandler<NotifyEventArgs> Notify; | ||
| public event DelOnNotify Notify; | ||
|
|
||
| /// <summary> | ||
| /// Triggered when a contract calls System.Runtime.Log. | ||
| /// </summary> | ||
| public static event EventHandler<LogEventArgs> Log; | ||
| public event EventHandler<LogEventArgs> Log; | ||
shargon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| public delegate void DelOnApplicationEngine(ApplicationEngine engine); | ||
|
||
|
|
||
| /// <summary> | ||
| /// On Application Engine | ||
| /// </summary> | ||
| public static DelOnApplicationEngine OnApplicationEngine; | ||
shargon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| private static Dictionary<uint, InteropDescriptor> services; | ||
| // Total amount of GAS spent to execute. | ||
|
|
@@ -435,8 +444,11 @@ public static ApplicationEngine Create(TriggerType trigger, IVerifiable containe | |
| // Adjust jump table according persistingBlock | ||
|
|
||
| var jumpTable = settings == null || settings.IsHardforkEnabled(Hardfork.HF_Echidna, index) ? DefaultJumpTable : NotEchidnaJumpTable; | ||
| return Provider?.Create(trigger, container, snapshot, persistingBlock, settings, gas, diagnostic, jumpTable) | ||
| var engine = Provider?.Create(trigger, container, snapshot, persistingBlock, settings, gas, diagnostic, jumpTable) | ||
| ?? new ApplicationEngine(trigger, container, snapshot, persistingBlock, settings, gas, diagnostic, jumpTable); | ||
|
|
||
| OnApplicationEngine?.Invoke(engine); | ||
shargon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return engine; | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -368,10 +368,10 @@ public void TestRuntime_Log() | |||||
| { | ||||||
| var engine = GetEngine(true); | ||||||
| var message = "hello"; | ||||||
| ApplicationEngine.Log += LogEvent; | ||||||
| engine.Log += LogEvent; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| engine.RuntimeLog(Encoding.UTF8.GetBytes(message)); | ||||||
| Assert.AreEqual(new byte[] { 0x01, 0x02, 0x03 }.ToHexString(), ((Transaction)engine.ScriptContainer).Script.Span.ToHexString()); | ||||||
| ApplicationEngine.Log -= LogEvent; | ||||||
| engine.Log -= LogEvent; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| [TestMethod] | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.