Skip to content

Commit

Permalink
Merge pull request #407 from alephium/simple-script-vm
Browse files Browse the repository at this point in the history
Simple script vm
  • Loading branch information
polarker authored Aug 15, 2024
2 parents 830c304 + 6a2fcce commit a3ebfcf
Show file tree
Hide file tree
Showing 55 changed files with 1,396 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/njsscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
args: '. --sarif --output results.sarif || true'

- name: Upload njsscan report
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif
18 changes: 15 additions & 3 deletions .project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"fullNodeVersion": "v3.5.0",
"fullNodeVersion": "v3.5.2",
"compilerOptionsUsed": {
"ignoreUnusedConstantsWarnings": false,
"ignoreUnusedVariablesWarnings": false,
Expand Down Expand Up @@ -208,6 +208,18 @@
"bytecodeDebugPatch": "",
"codeHashDebug": ""
},
"MultiDeposit": {
"sourceFile": "test/transact.ral",
"sourceCodeHash": "04184bcb0fbfe358d2175574d6479ec9882445ef09a1bc521f3e742847afceb6",
"bytecodeDebugPatch": "",
"codeHashDebug": ""
},
"MultiWithdraw": {
"sourceFile": "test/transact.ral",
"sourceCodeHash": "04184bcb0fbfe358d2175574d6479ec9882445ef09a1bc521f3e742847afceb6",
"bytecodeDebugPatch": "",
"codeHashDebug": ""
},
"NFTCollectionTest": {
"sourceFile": "nft/nft_collection_test.ral",
"sourceCodeHash": "ac1d8da86e8cb3e5c412c463d7cf0376db563d9cbc459eb034d3067dcaa2045e",
Expand Down Expand Up @@ -288,9 +300,9 @@
},
"Transact": {
"sourceFile": "test/transact.ral",
"sourceCodeHash": "be72f5d014486592f9ba43c41ded84a6c11dea338f2d0a86736ee6d1bd62f7fe",
"sourceCodeHash": "04184bcb0fbfe358d2175574d6479ec9882445ef09a1bc521f3e742847afceb6",
"bytecodeDebugPatch": "",
"codeHashDebug": "e69364160d369d3459e19d1b2fcaae7f0cac7059357dba5616147ea18d0c1f0e"
"codeHashDebug": "85e3e9a803741af8e92bd43b1b07cde53f39b86cab0ef1a85bab12b10d691b55"
},
"UpdateMapValue": {
"sourceFile": "test/map.ral",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/add/Add.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "Add",
"bytecode": "0206124024404f407440a140af010002100205d34fbb20db1600160100020201000c0c0205d36a51f82d1600160100020200000202021805160016015f06160016015f075da00016002a16012aa100a000160016010e0dce000100020103040c0011d319adf50e1300641600130164170517041603d1a21601160216041605c118010104060015d3f6ce55a6130064160013016417051704160316021340c8ac1603d1a21601160216041605c118010201010003d320f98f621600b0",
"codeHash": "6a1f1415a68d55365e205b39e5418cd1f6fc8c2c7926d3662c77d69b55c92681",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/add/AddMain.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "AddMain",
"bytecodeTemplate": "0101030002000c{1}{2}17011700160016010e0e{0}01001818",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/add/DestroyAdd.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "DestroyAdd",
"bytecodeTemplate": "01010300000005{1}0d0c{0}0105",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/greeter/Greeter.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "Greeter",
"bytecode": "190111010000000106d3952f757b030c7bce0002",
"codeHash": "4bbf82c83dcb0a3df905c290fbc12a19ce5160a7b655c1a347913481da12d747",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/greeter/GreeterMain.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "GreeterMain",
"bytecodeTemplate": "01010300020014{0}17000c0d160001000d2f0c7b{0}17010c0d1601d4952f757b0d2f0c7b",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/DeprecatedNFTTest1.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "DeprecatedNFTTest1",
"bytecode": "02010e010000000103d3ee6a5cd5ce0102",
"codeHash": "cc6928c9c6777077abcb5b9c4f7c5d620d6cae07ec6f00f5e8b0efe6a7b913c4",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/DeprecatedNFTTest2.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "DeprecatedNFTTest2",
"bytecode": "02020e1c010000000103d3ee6a5cd5ce0102010000000103d33e65d93dce0002",
"codeHash": "ade9aee476ee752050a1e9e1b19039f05261cb3f53941152617174faf9eae572",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/DeprecatedNFTTest3.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "DeprecatedNFTTest3",
"bytecode": "02020e19010000000103d3ee6a5cd5ce0102010000000001d34d12f529",
"codeHash": "465bc3739cd1649e58e0470971bd2fabf21363ab9fc2c15052fb2440dd06ada5",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/DeprecatedNFTTest4.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "DeprecatedNFTTest4",
"bytecode": "02020e1b010000000103d3ee6a5cd5ce0102010000000103d35f9a418a0402",
"codeHash": "a5de0fa0b3580303ac63423f09ce5ed95fccbf789679b32130a53c26fef182e9",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/DeprecatedNFTTest5.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "DeprecatedNFTTest5",
"bytecode": "02020e1e010000000103d3ee6a5cd5ce0102010000000305d35c9ec8a3ce000c0c02",
"codeHash": "8b1374f39db98c485af3dd05d0b0ce861e9528f290ca9dc0d7108e8b48b50161",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/DeprecatedNFTTest6.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "DeprecatedNFTTest6",
"bytecode": "02020e1c010000000103d3ee6a5cd5ce0102010000000204d30e0a3ac10c0d02",
"codeHash": "8bc0d39f0607d4a771ec70ae1057b71dbcde404177cb3b25fd7d93d553a2b8cd",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/DeprecatedNFTTest7.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "DeprecatedNFTTest7",
"bytecode": "02020e1d010000000103d3ee6a5cd5ce0102010000000204d3289dd321ce000b02",
"codeHash": "b95c9acf088b090f5d9d34f28ab079cf22b9e53af8ae6864113c71172231ef4c",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/MintNFTTest.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "MintNFTTest",
"bytecodeTemplate": "01010300000015{2}4c0ab413c40de0b6b3a7640000a2{1}0d0d{0}0107184a09b413c40de0b6b3a7640000a2{1}0d0d{0}010418",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/NFTCollectionTest.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "NFTCollectionTest",
"bytecode": "04050912402d4040408a010000000102ce0102010000000102a0000201000102010f16000001310c7b160040cb17011601c50d7b16010201000203000816010002170216001602410e7b01030105011fd3b8b591eeb41701b1a00016001406414c5048000313046413006417031702160113c40de0b6b3a7640000a2a00040ce00160216030d1601c91704a0000d2aa100160402",
"codeHash": "087f9292bb326a4d39a6fac09928cb25edf2837718f830f3a166a937f8724779",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/NFTCollectionWithRoyaltyTest.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "NFTCollectionWithRoyaltyTest",
"bytecode": "06080912402d40404050405b406c40b6010000000102ce0102010000000102a0000201000102010f16000001310c7b160040cb17011601c50d7b16010201000203000816010002170216001602410e7b0100020201061601ce032c1367102d0201010202000316001601a9010202020008b4ce02450f7b16001601a801030105011fd3b8b591eeb41701b1a00016001406414c5048000313046413006417031702160113c40de0b6b3a7640000a2a00040ce00160216030d1601c91704a0000d2aa100160402",
"codeHash": "3b64d5e360566a4e4f568f773536a3ea74e66d12231aa44f19d2214ba87b38d6",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/NFTTest.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "NFTTest",
"bytecode": "04020914010000000102ce0202010000000203ce00ce0102",
"codeHash": "4897086210869e612d82995b765a447c5319a55a56e8a0c3c07b4d9ca81e15b1",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/NFTTestStd.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "NFTTestStd",
"bytecode": "040309144020010000000102ce0202010000000203ce00ce0102010000000002d36811cfdd02",
"codeHash": "b7ff3fa8dfacc7ae5edbabd6573d0699dffc5a0f07ad14023f682a201b7bce55",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/WithdrawNFTCollectionTest.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "WithdrawNFTCollectionTest",
"bytecodeTemplate": "01010300000006b4{1}0e0c{0}0106",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/nft/WrongNFTTest.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "WrongNFTTest",
"bytecode": "04020917010000000102ce0202010000000206040c7bce00ce0102",
"codeHash": "7dd2ed643a98b2a1a52a9b9e536fcdae60d961b583b8109f777d846bfdfcae8d",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/sub/Sub.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "Sub",
"bytecode": "01011e01000202010dd321939f9e05160016015fa00016002a16012ba100a00002",
"codeHash": "3461ebfaca02ad0a3f587a5b67a461c0cbd82d14261407b1d9277ed4ad129234",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/Assert.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "Assert",
"bytecode": "000110010000000006d362d460120d0e2f0f7b",
"codeHash": "46dc5e3835be6551dacbf81565912ec67575aa77522312ceed88472817735d6b",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/CallScript0.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "CallScript0",
"bytecodeTemplate": "01010000000206{1}0d0e{0}010302",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/CallScript1.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "CallScript1",
"bytecodeTemplate": "0101000000070a{1}0d0e{0}01030c11{2}010202",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/Debug.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "Debug",
"bytecode": "00010b010000000001d38681d619",
"codeHash": "cc0e1966e6847f2c03384e78df1dcd9a0c2b5db1b7c1e901d66e26e2b000eb2c",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/InsertIntoMap.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "InsertIntoMap",
"bytecodeTemplate": "01010300020010{2}{3}17011700{1}d10f2ca2{1}160016010f0c{0}0100",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/MapTest.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "MapTest",
"bytecode": "0004405c40dc4153418001030303001fd3a9cdcc691600d1a2140a5f5f6d61705f5f305f5f160047441601b11602d202011600d1a2140a5f5f6d61705f5f315f5f16014044b11602d201011600d1a2140a5f5f6d61705f5f325f5f1402001144b11602d2010101000104004036d3c50ed2bb0c0d0d140a5f5f6d61705f5f305f5f16004744cb1703160301000c0d0d160301011702170116020d2a0c0e0c140a5f5f6d61705f5f305f5f16004744cb010216020d2a0c0e0c140a5f5f6d61705f5f315f5f16014044cb010216020d2a0c0e0c140a5f5f6d61705f5f325f5f1402001144cb01020100010400402dd392ac08660c0d0d140a5f5f6d61705f5f305f5f16004744cb1703160301000c0d0d160301011702170116000d0c140a5f5f6d61705f5f305f5f16004744cb010316000d0c140a5f5f6d61705f5f315f5f16014044cb010316000d0c140a5f5f6d61705f5f325f5f1402001144cb0103010001020212d3143f7dc50c0d0d140a5f5f6d61705f5f305f5f16004744cb1701160101000c0d0d1601010102",
"codeHash": "9c0dad73dd47255270a366794f84539f06816e30c68b1f1cca767707fa8db596",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/MetaData.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "MetaData",
"bytecode": "000319402c4033010300000006d38d0b3636b4b413c40de0b6b3a7640000a702000200000004b413c40de0b6b3a7640000a80200000000000102",
"codeHash": "5b113459525557465f1cc5aeee453dfd5823d1a6094372cee6067f7466b40896",
Expand Down
28 changes: 28 additions & 0 deletions artifacts/test/MultiDeposit.ral.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "v3.5.2",
"name": "MultiDeposit",
"bytecodeTemplate": "0101030002004024{0}{1}17011700b413c40de0b6b3a7640000a20c0c16000100b413c40de0b6b3a7640000a20c0c16010100b4{2}13c40de0b6b3a7640000a313c40de0b6b3a76400000d0c16000102b4{2}13c40de0b6b3a7640000a313c40de0b6b3a76400000d0c16010102",
"fieldsSig": {
"names": [
"c",
"tokenId"
],
"types": [
"[Transact;2]",
"ByteVec"
],
"isMutable": [
false,
false
]
},
"functions": [
{
"name": "main",
"paramNames": [],
"paramTypes": [],
"paramIsMutable": [],
"returnTypes": []
}
]
}
25 changes: 25 additions & 0 deletions artifacts/test/MultiWithdraw.ral.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": "v3.5.2",
"name": "MultiWithdraw",
"bytecodeTemplate": "01010300020016{0}{1}170117000c0c160001010c0c1601010113c40de0b6b3a76400000d0c1600010313c40de0b6b3a76400000d0c16010103",
"fieldsSig": {
"names": [
"c"
],
"types": [
"[Transact;2]"
],
"isMutable": [
false
]
},
"functions": [
{
"name": "main",
"paramNames": [],
"paramTypes": [],
"paramIsMutable": [],
"returnTypes": []
}
]
}
2 changes: 1 addition & 1 deletion artifacts/test/OwnerOnly.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "OwnerOnly",
"bytecode": "010111010000000006d3bf853dbdb4ce00450c7b",
"codeHash": "c8ecfd7b7e1f3d0169d80e0abb59702516eeff301d47e0e7be70a631bd9414ca",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/RemoveFromMap.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "RemoveFromMap",
"bytecodeTemplate": "01010300000005{1}0d0c{0}0102",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/TemplateArrayVar.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "TemplateArrayVar",
"bytecodeTemplate": "010103000e00408d{1}{2}{3}{4}1703170217011700{6}{7}{8}170617051704{0}18{5}1816030f2f16020e2f1a16010d2f1a16000c2f1a0c7b160016011708170716070c2f16080d2f1a0c7b16021603170a170916090e2f160a0f2f1a0c7b16060e2f16050d2f1a16040c2f1a0c7b0c170b160b0e314c40260c170c160c0e314c1b160b7a0e314d0e2c160c7a0e314d2a78160b0e2c160c2a2f0c7b160c0d2a170c4a21160b0d2a170b4a7fd60c170d160d0f314c11160d7a0f314d102a78160d2f0c7b160d0d2a170d4a2b",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/TestAssert.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "TestAssert",
"bytecodeTemplate": "010103000000040c0c{0}0100",
"fieldsSig": {
Expand Down
51 changes: 46 additions & 5 deletions artifacts/test/Transact.ral.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "Transact",
"bytecode": "01034027404e405c010100000009d353dbb7aab413c40de0b6b3a7640000a9a00013c40de0b6b3a76400002aa10002010200000009d3a248861cb413c40de0b6b3a7640000a8a00013c40de0b6b3a76400002ba10002010000000103d376c7c673a00002",
"codeHash": "e69364160d369d3459e19d1b2fcaae7f0cac7059357dba5616147ea18d0c1f0e",
"bytecode": "03064027404e40674080408e409c010100010009d353dbb7aab413c40de0b6b3a7640000a9a00013c40de0b6b3a76400002aa10002010200010009d3a248861cb413c40de0b6b3a7640000a8a00013c40de0b6b3a76400002ba1000201010101000ad3bf2d01bdb4ce001600aca00116002aa1010201020101000ad35496306fb4ce001600aba00116002ba10102010000000103d3815a8d0da00002010000000103d3a51b051ca00102",
"codeHash": "85e3e9a803741af8e92bd43b1b07cde53f39b86cab0ef1a85bab12b10d691b55",
"fieldsSig": {
"names": [
"totalDeposits"
"tokenId",
"totalALPH",
"totalTokens"
],
"types": [
"ByteVec",
"U256",
"U256"
],
"isMutable": [
false,
true,
true
]
},
Expand All @@ -31,7 +37,42 @@
"returnTypes": []
},
{
"name": "getTotalDeposits",
"name": "depositToken",
"paramNames": [
"amount"
],
"paramTypes": [
"U256"
],
"paramIsMutable": [
false
],
"returnTypes": []
},
{
"name": "withdrawToken",
"paramNames": [
"amount"
],
"paramTypes": [
"U256"
],
"paramIsMutable": [
false
],
"returnTypes": []
},
{
"name": "getTotalALPH",
"paramNames": [],
"paramTypes": [],
"paramIsMutable": [],
"returnTypes": [
"U256"
]
},
{
"name": "getTotalTokens",
"paramNames": [],
"paramTypes": [],
"paramIsMutable": [],
Expand Down
2 changes: 1 addition & 1 deletion artifacts/test/UpdateMapValue.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.5.0",
"version": "v3.5.2",
"name": "UpdateMapValue",
"bytecodeTemplate": "01010300000005{1}0d0c{0}0101",
"fieldsSig": {
Expand Down
Loading

0 comments on commit a3ebfcf

Please sign in to comment.