Skip to content
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

make it possible to build large objects #33

Merged
merged 1 commit into from
Jun 12, 2024
Merged
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
68 changes: 68 additions & 0 deletions PoC/NewConstructionOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System.ComponentModel;
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Attributes;
using Neo.SmartContract.Framework.Services;


// TARGET COMMIT
// NEO v3.7.4 7f227a3026fadeb9723280e6f961b6f29b0f8a7a

namespace bigevent
{
[DisplayName("bigevent")]
[ManifestExtra("Author", "Tanya")]
[ManifestExtra("Email", "[email protected]")]
[ManifestExtra("Description", "This is a big event")]
public class bigevent : SmartContract
{
public static int aaa = 0; // do not delete, used for Concat's static field init
public static ByteString[] ns = new ByteString[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" };
public static int bbb = 0; // do not delete, used for Concat's static field init
public static int ccc = 0; // do not delete, used for Concat's static field init
public static int ddd = 0; // do not delete, used for Concat's static field init

public static event SyncedEvent Synced;
public delegate void SyncedEvent(object ns);

// https://github.com/neo-project/neo/issues/3296
public static object Main(int i)
{
while (i > 0)
{
Synced(ns);
i--;
}
return Runtime.GetNotifications(Runtime.ExecutingScriptHash);
}
// https://github.com/neo-project/neo/issues/3300
public static int MaxSize(int num)
{
for (int i = 0; i < 300; i++)
{
Synced(ns);
}

int[] small = new int[100];
int[] result = new int[0];

for (int i = 0; i < num; i++)
{
Runtime.GetNotifications(Runtime.ExecutingScriptHash);
result = Concat(result, small);
}
return result.Length;
}

[OpCode(OpCode.UNPACK)] // [a], b1,b2,b3, 3
[OpCode(OpCode.DUP)] // [a], b1,b2,b3, 3, 3
[OpCode(OpCode.STSFLD3)] // [a], b1,b2,b3, 3 [fld3 = 3]
[OpCode(OpCode.INC)] // [a], b1,b2,b3, 4
[OpCode(OpCode.REVERSEN)] // b3,b2,b1, [a]
[OpCode(OpCode.UNPACK)] // b3,b2,b1, a1,a2, 2
[OpCode(OpCode.LDSFLD3)] // b3,b2,b1, a1,a2, 2, 3
[OpCode(OpCode.ADD)] // b3,b2,b1, a1,a2, 5
[OpCode(OpCode.PACK)] // [a,b]
public static extern int[] Concat(int[] a, int[] b);

}
}