diff --git a/Cargo.lock b/Cargo.lock index 606a133e..243e70d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3743,9 +3743,10 @@ dependencies = [ [[package]] name = "polkavm-derive-impl" -version = "0.18.1" +version = "0.18.0" +source = "git+https://github.com/koute/polkavm?branch=master#8b9a836a244726dfba940aa0077b9208a2cc0c77" dependencies = [ - "polkavm-common 0.18.0", + "polkavm-common 0.18.0 (git+https://github.com/koute/polkavm?branch=master)", "proc-macro2", "quote", "syn 2.0.90", @@ -3753,10 +3754,9 @@ dependencies = [ [[package]] name = "polkavm-derive-impl" -version = "0.18.0" -source = "git+https://github.com/koute/polkavm?branch=master#8b9a836a244726dfba940aa0077b9208a2cc0c77" +version = "0.18.1" dependencies = [ - "polkavm-common 0.18.0 (git+https://github.com/koute/polkavm?branch=master)", + "polkavm-common 0.18.0", "proc-macro2", "quote", "syn 2.0.90", @@ -3766,7 +3766,7 @@ dependencies = [ name = "polkavm-derive-impl-macro" version = "0.18.0" dependencies = [ - "polkavm-derive-impl 0.18.0", + "polkavm-derive-impl 0.18.1", "syn 2.0.90", ] @@ -3775,7 +3775,7 @@ name = "polkavm-derive-impl-macro" version = "0.18.0" source = "git+https://github.com/koute/polkavm?branch=master#8b9a836a244726dfba940aa0077b9208a2cc0c77" dependencies = [ - "polkavm-derive-impl 0.18.0 (git+https://github.com/koute/polkavm?branch=master)", + "polkavm-derive-impl 0.18.0", "syn 2.0.90", ] diff --git a/services/Cargo.lock b/services/Cargo.lock index 2b28dcbb..c3a8f7c9 100644 --- a/services/Cargo.lock +++ b/services/Cargo.lock @@ -3574,8 +3574,9 @@ dependencies = [ [[package]] name = "polkavm-derive-impl" version = "0.18.0" +source = "git+https://github.com/koute/polkavm?branch=master#8b9a836a244726dfba940aa0077b9208a2cc0c77" dependencies = [ - "polkavm-common 0.18.0", + "polkavm-common 0.18.0 (git+https://github.com/koute/polkavm?branch=master)", "proc-macro2", "quote", "syn 2.0.90", @@ -3583,10 +3584,9 @@ dependencies = [ [[package]] name = "polkavm-derive-impl" -version = "0.18.0" -source = "git+https://github.com/koute/polkavm?branch=master#8b9a836a244726dfba940aa0077b9208a2cc0c77" +version = "0.18.1" dependencies = [ - "polkavm-common 0.18.0 (git+https://github.com/koute/polkavm?branch=master)", + "polkavm-common 0.18.0", "proc-macro2", "quote", "syn 2.0.90", @@ -3596,7 +3596,7 @@ dependencies = [ name = "polkavm-derive-impl-macro" version = "0.18.0" dependencies = [ - "polkavm-derive-impl 0.18.0", + "polkavm-derive-impl 0.18.1", "syn 2.0.90", ] @@ -3605,7 +3605,7 @@ name = "polkavm-derive-impl-macro" version = "0.18.0" source = "git+https://github.com/koute/polkavm?branch=master#8b9a836a244726dfba940aa0077b9208a2cc0c77" dependencies = [ - "polkavm-derive-impl 0.18.0 (git+https://github.com/koute/polkavm?branch=master)", + "polkavm-derive-impl 0.18.0", "syn 2.0.90", ] diff --git a/services/bootstrap/bootstrap.pvm b/services/bootstrap/bootstrap.pvm index 02570a78..ac97e3ab 100644 Binary files a/services/bootstrap/bootstrap.pvm and b/services/bootstrap/bootstrap.pvm differ diff --git a/services/bootstrap/bootstrap.txt b/services/bootstrap/bootstrap.txt index aecdd623..e6433b3a 100644 --- a/services/bootstrap/bootstrap.txt +++ b/services/bootstrap/bootstrap.txt @@ -24,23 +24,23 @@ 34: 33 07 a0 = 0x0 36: 32 00 ret : @6 [export #2: 'accumulate'] - 38: 8b 11 f8 i64 sp = i64 sp - i64 8 - 41: 71 10 u64 [sp] = ra + 38: 95 11 f8 sp = sp - 8 + 41: 7b 10 u64 [sp] = ra 43: 14 07 00 00 ff fe 00 00 00 00 a0 = 0xfeff0000 - 53: 78 78 20 a1 = u64 [a0 + 32] + 53: 82 78 20 a1 = u64 [a0 + 32] 56: 33 09 64 a2 = 0x64 59: 33 0a 64 a3 = 0x64 62: 0a 09 ecalli 9 // 'new' 64: 14 0b 00 e0 fd fe 00 00 00 00 a4 = 0xfefde000 74: 49 0b u64 [a4 + 0] = 0 - 76: 71 b7 04 u64 [a4 + 4] = a0 + 76: 7b b7 04 u64 [a4 + 4] = a0 79: 14 09 04 e0 fd fe 00 00 00 00 a2 = 0xfefde004 89: 33 08 04 a1 = 0x4 92: 33 0a 04 a3 = 0x4 95: 14 07 00 e0 fd fe 00 00 00 00 a0 = 0xfefde000 105: 0a 03 ecalli 3 // 'write' - 107: 78 10 ra = u64 [sp] - 109: 8b 11 08 i64 sp = i64 sp + 0x8 + 107: 82 10 ra = u64 [sp] + 109: 95 11 08 sp = sp + 0x8 112: 32 00 ret : @7 [export #3: 'on_transfer'] 114: 33 07 a0 = 0x0 diff --git a/services/bootstrap/bootstrap_blob.pvm b/services/bootstrap/bootstrap_blob.pvm index 22b9435a..8f6f5c1e 100644 Binary files a/services/bootstrap/bootstrap_blob.pvm and b/services/bootstrap/bootstrap_blob.pvm differ diff --git a/services/fib/fib.pvm b/services/fib/fib.pvm index 2e9e861e..ff3ee471 100644 Binary files a/services/fib/fib.pvm and b/services/fib/fib.pvm differ diff --git a/services/fib/fib.txt b/services/fib/fib.txt index 01f9aeae..f4bcf977 100644 --- a/services/fib/fib.txt +++ b/services/fib/fib.txt @@ -19,19 +19,19 @@ 18: 33 07 a0 = 0x0 20: 32 00 ret : @5 [export #1: 'refine'] - 22: 8b 11 d8 i64 sp = i64 sp - i64 40 - 25: 71 10 20 u64 [sp + 32] = ra - 28: 71 15 18 u64 [sp + 24] = s0 - 31: 71 16 10 u64 [sp + 16] = s1 + 22: 95 11 d8 sp = sp - 40 + 25: 7b 10 20 u64 [sp + 32] = ra + 28: 7b 15 18 u64 [sp + 24] = s0 + 31: 7b 16 10 u64 [sp + 16] = s1 34: 48 11 08 u32 [sp + 8] = 0 37: 49 01 u64 [sp + 0] = 0 39: 64 18 a1 = sp 41: 33 09 0c a2 = 0xc 44: 33 07 a0 = 0x0 - 46: 0a 10 ecalli 16 // 'import' + 46: 0a 12 ecalli 18 // 'import' 48: 01 fallthrough : @6 - 49: 79 77 a0 = a0 + 0x0 + 49: 83 77 i32 a0 = a0 + 0x0 51: 51 07 0d jump @8 if a0 == 0 : @7 54: 33 07 a0 = 0x0 @@ -39,43 +39,43 @@ 59: 33 08 01 a1 = 0x1 62: 28 11 jump @9 : @8 - 64: 77 17 04 a0 = i32 [sp + 4] - 67: 77 18 08 a1 = i32 [sp + 8] - 70: 77 19 a2 = i32 [sp] - 72: aa 78 08 a1 = a1 + a0 - 75: 79 99 01 a2 = a2 + 0x1 + 64: 81 17 04 a0 = i32 [sp + 4] + 67: 81 18 08 a1 = i32 [sp + 8] + 70: 81 19 a2 = i32 [sp] + 72: be 78 08 i32 a1 = a1 + a0 + 75: 83 99 01 i32 a2 = a2 + 0x1 78: 01 fallthrough : @9 - 79: 70 19 u32 [sp] = a2 - 81: 70 18 04 u32 [sp + 4] = a1 - 84: 70 17 08 u32 [sp + 8] = a0 + 79: 7a 19 u32 [sp] = a2 + 81: 7a 18 04 u32 [sp + 4] = a1 + 84: 7a 17 08 u32 [sp + 8] = a0 87: 64 15 s0 = sp 89: 33 06 0c s1 = 0xc 92: 64 17 a0 = sp 94: 33 08 0c a1 = 0xc - 97: 0a 11 ecalli 17 // 'export' + 97: 0a 13 ecalli 19 // 'export' 99: 64 5a a3 = s0 101: 64 6b a4 = s1 103: 33 07 a0 = 0x0 - 105: 78 10 20 ra = u64 [sp + 32] - 108: 78 15 18 s0 = u64 [sp + 24] - 111: 78 16 10 s1 = u64 [sp + 16] - 114: 8b 11 28 i64 sp = i64 sp + 0x28 + 105: 82 10 20 ra = u64 [sp + 32] + 108: 82 15 18 s0 = u64 [sp + 24] + 111: 82 16 10 s1 = u64 [sp + 16] + 114: 95 11 28 sp = sp + 0x28 117: 32 00 ret : @10 [export #2: 'accumulate'] - 119: 8b 11 f0 i64 sp = i64 sp - i64 16 - 122: 71 10 08 u64 [sp + 8] = ra + 119: 95 11 f0 sp = sp - 16 + 122: 7b 10 08 u64 [sp + 8] = ra 125: 46 11 07 u8 [sp + 7] = 0 - 128: 8b 17 07 i64 a0 = i64 sp + 0x7 - 131: 8d 77 20 a0 = a0 <<64 32 - 134: 8e 77 20 a0 = a0 >>64 32 + 128: 95 17 07 a0 = sp + 0x7 + 131: 97 77 20 a0 = a0 << 32 + 134: 98 77 20 a0 = a0 >> 32 137: 14 09 00 00 ff fe 00 00 00 00 a2 = 0xfeff0000 147: 33 08 01 a1 = 0x1 150: 33 0a 0c a3 = 0xc 153: 0a 03 ecalli 3 // 'write' 155: 33 07 a0 = 0x0 - 157: 78 10 08 ra = u64 [sp + 8] - 160: 8b 11 10 i64 sp = i64 sp + 0x10 + 157: 82 10 08 ra = u64 [sp + 8] + 160: 95 11 10 sp = sp + 0x10 163: 32 00 ret : @11 [export #3: 'on_transfer'] 165: 33 07 a0 = 0x0 diff --git a/services/fib/fib_blob.pvm b/services/fib/fib_blob.pvm index bdc7c012..8fe0ddae 100644 Binary files a/services/fib/fib_blob.pvm and b/services/fib/fib_blob.pvm differ diff --git a/services/fib/src/main.rs b/services/fib/src/main.rs index c2c8afbe..1bfacf7f 100644 --- a/services/fib/src/main.rs +++ b/services/fib/src/main.rs @@ -18,64 +18,12 @@ fn panic(_info: &core::panic::PanicInfo) -> ! { #[polkavm_derive::polkavm_import] extern "C" { - #[polkavm_import(index = 0)] - pub fn gas() -> i64; - #[polkavm_import(index = 1)] - pub fn lookup(service: u32, hash_ptr: *const u8, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 2)] - pub fn read(service: u32, key_ptr: *const u8, key_len: u32, out: *mut u8, out_len: u32) -> u32; - // #[polkavm_import(index = 3)] - // pub fn write(key_ptr: *const u8, key_len: u32, value: *const u8, value_len: u32) -> u32; - #[polkavm_import(index = 3)] pub fn write(ko: u32, kz: u32, bo: u32, bz: u32) -> u32; - - #[polkavm_import(index = 4)] - pub fn info(service: u32, out: *mut u8) -> u32; - #[polkavm_import(index = 5)] - pub fn empower(m: u32, a: u32, v: u32, o: u32, n: u32) -> u32; - #[polkavm_import(index = 6)] - pub fn assign(c: u32, out: *mut u8) -> u32; - #[polkavm_import(index = 7)] - pub fn designate(out: *mut u8) -> u32; - #[polkavm_import(index = 8)] - pub fn checkpoint() -> u64; - #[polkavm_import(index = 9)] - pub fn new(service: u32, hash_ptr: *const u8, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 10)] - pub fn upgrade(out: *const u8, g: u64, m: u64) -> u32; - #[polkavm_import(index = 11)] - pub fn transfer(d: u32, a: u64, g: u64, out: *mut u8) -> u32; - #[polkavm_import(index = 12)] - pub fn quit(d: u32, a: u64, g: u64, out: *mut u8) -> u32; - #[polkavm_import(index = 13)] - pub fn solicit(hash_ptr: *const u8, z: u32) -> u32; - #[polkavm_import(index = 14)] - pub fn forget(hash_ptr: *const u8, z: u32) -> u32; - #[polkavm_import(index = 15)] - pub fn historical_lookup(service: u32, hash_ptr: *const u8, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 16)] - pub fn import(import_index: u32, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 17)] - pub fn export(out: *const u8, out_len: u32) -> u32; #[polkavm_import(index = 18)] - pub fn machine(out: *const u8, out_len: u32) -> u32; + pub fn import(import_index: u32, out: *mut u8, out_len: u32) -> u32; #[polkavm_import(index = 19)] - pub fn peek(out: *const u8, out_len: u32, i: u32) -> u32; - #[polkavm_import(index = 20)] - pub fn poke(n: u32, a: u32, b: u32, l: u32) -> u32; - #[polkavm_import(index = 21)] - pub fn invoke(n: u32, out: *mut u8) -> u32; - #[polkavm_import(index = 22)] - pub fn expunge(n: u32) -> u32; - #[polkavm_import(index = 99)] - pub fn blake2b(data: *const u8, data_len: u32, hash_ptr: *mut u8) -> u32; - #[polkavm_import(index = 100)] - pub fn blake2s(data: *const u8, data_len: u32, hash_ptr: *mut u8) -> u32; - #[polkavm_import(index = 101)] - pub fn ecrecover(h: *const u8, v: *const u8, r: *const u8, s: *const u8, out: *mut u8) -> u32; - #[polkavm_import(index = 102)] - pub fn sha2_256(data: *const u8, data_len: u32, hash_ptr: *mut u8) -> u32; + pub fn export(out: *const u8, out_len: u32) -> u32; } #[polkavm_derive::polkavm_export] diff --git a/services/megatron/megatron.pvm b/services/megatron/megatron.pvm index df6ff3ff..ee2c8d24 100644 Binary files a/services/megatron/megatron.pvm and b/services/megatron/megatron.pvm differ diff --git a/services/megatron/megatron.txt b/services/megatron/megatron.txt index 0f2d8dfd..3ca547dc 100644 --- a/services/megatron/megatron.txt +++ b/services/megatron/megatron.txt @@ -24,41 +24,41 @@ 35: 33 07 a0 = 0x0 37: 32 00 ret : @6 [export #2: 'accumulate'] - 39: 8b 11 c0 i64 sp = i64 sp - i64 64 - 42: 71 10 38 u64 [sp + 56] = ra - 45: 71 15 30 u64 [sp + 48] = s0 + 39: 95 11 c0 sp = sp - 64 + 42: 7b 10 38 u64 [sp + 56] = ra + 45: 7b 15 30 u64 [sp + 48] = s0 48: 48 11 08 u32 [sp + 8] = 0 51: 49 01 u64 [sp + 0] = 0 53: 48 11 18 u32 [sp + 24] = 0 56: 49 11 10 u64 [sp + 16] = 0 59: 46 11 1f u8 [sp + 31] = 0 62: 14 08 00 00 ff fe 00 00 00 00 a1 = 0xfeff0000 - 72: 76 87 a0 = u32 [a1] - 74: 76 85 04 s0 = u32 [a1 + 4] - 77: 8b 18 1f i64 a1 = i64 sp + 0x1f + 72: 80 87 a0 = u32 [a1] + 74: 80 85 04 s0 = u32 [a1 + 4] + 77: 95 18 1f a1 = sp + 0x1f 80: 33 09 01 a2 = 0x1 83: 64 1a a3 = sp 85: 33 0b 0c a4 = 0xc 88: 0a 02 ecalli 2 // 'read' - 90: 8b 18 1f i64 a1 = i64 sp + 0x1f + 90: 95 18 1f a1 = sp + 0x1f 93: 33 09 01 a2 = 0x1 - 96: 8b 1a 10 i64 a3 = i64 sp + 0x10 + 96: 95 1a 10 a3 = sp + 0x10 99: 33 0b 0c a4 = 0xc 102: 64 57 a0 = s0 104: 0a 02 ecalli 2 // 'read' - 106: 77 17 04 a0 = i32 [sp + 4] - 109: 77 18 08 a1 = i32 [sp + 8] - 112: 77 19 14 a2 = i32 [sp + 20] - 115: 77 1a 18 a3 = i32 [sp + 24] - 118: 77 1b a4 = i32 [sp] - 120: aa 97 07 a0 = a0 + a2 - 123: aa a8 08 a1 = a1 + a3 - 126: 70 1b 20 u32 [sp + 32] = a4 - 129: 70 17 24 u32 [sp + 36] = a0 - 132: 70 18 28 u32 [sp + 40] = a1 - 135: 8b 17 1f i64 a0 = i64 sp + 0x1f + 106: 81 17 04 a0 = i32 [sp + 4] + 109: 81 18 08 a1 = i32 [sp + 8] + 112: 81 19 14 a2 = i32 [sp + 20] + 115: 81 1a 18 a3 = i32 [sp + 24] + 118: 81 1b a4 = i32 [sp] + 120: be 97 07 i32 a0 = a0 + a2 + 123: be a8 08 i32 a1 = a1 + a3 + 126: 7a 1b 20 u32 [sp + 32] = a4 + 129: 7a 17 24 u32 [sp + 36] = a0 + 132: 7a 18 28 u32 [sp + 40] = a1 + 135: 95 17 1f a0 = sp + 0x1f 138: 33 08 01 a1 = 0x1 - 141: 8b 19 20 i64 a2 = i64 sp + 0x20 + 141: 95 19 20 a2 = sp + 0x20 144: 33 0a 0c a3 = 0xc 147: 0a 03 ecalli 3 // 'write' 149: 00 trap diff --git a/services/megatron/megatron_blob.pvm b/services/megatron/megatron_blob.pvm index 88af8711..e66d29be 100644 Binary files a/services/megatron/megatron_blob.pvm and b/services/megatron/megatron_blob.pvm differ diff --git a/services/transfer/src/main.rs b/services/transfer/src/main.rs index 7a07ae3a..77be09ff 100644 --- a/services/transfer/src/main.rs +++ b/services/transfer/src/main.rs @@ -18,46 +18,8 @@ fn panic(_info: &core::panic::PanicInfo) -> ! { #[polkavm_derive::polkavm_import] extern "C" { - - #[polkavm_import(index = 1)] - pub fn lookup(service: u32, hash_ptr: *const u8, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 2)] - pub fn read(service: u32, key_ptr: *const u8, key_len: u32, out: *mut u8, out_len: u32) -> u32; - - #[polkavm_import(index = 3)] - pub fn write(ko: u64, kz: u64, bo: u64, bz: u64) -> u64; - - #[polkavm_import(index = 4)] - pub fn info(service: u64, out: u64) -> u64; - - #[polkavm_import(index = 9)] - pub fn new(service: u32, hash_ptr: *const u8, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 10)] - pub fn upgrade(out: *const u8, g: u64, m: u64) -> u32; #[polkavm_import(index = 11)] pub fn transfer(d: u64, a: u64, g: u64, out: u64) -> u64; - #[polkavm_import(index = 12)] - pub fn quit(d: u32, a: u64, g: u64, out: *mut u8) -> u32; - #[polkavm_import(index = 13)] - pub fn solicit(hash_ptr: *const u8, z: u32) -> u32; - #[polkavm_import(index = 14)] - pub fn forget(hash_ptr: *const u8, z: u32) -> u32; - #[polkavm_import(index = 15)] - pub fn historical_lookup(service: u32, hash_ptr: *const u8, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 16)] - pub fn import(import_index: u32, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 17)] - pub fn export(out: *const u8, out_len: u32) -> u32; - #[polkavm_import(index = 18)] - pub fn machine(out: *const u8, out_len: u32) -> u32; - #[polkavm_import(index = 19)] - pub fn peek(out: *const u8, out_len: u32, i: u32) -> u32; - #[polkavm_import(index = 20)] - pub fn poke(n: u32, a: u32, b: u32, l: u32) -> u32; - #[polkavm_import(index = 21)] - pub fn invoke(n: u32, out: *mut u8) -> u32; - #[polkavm_import(index = 22)] - pub fn expunge(n: u32) -> u32; } #[polkavm_derive::polkavm_export] diff --git a/services/transfer/transfer.pvm b/services/transfer/transfer.pvm index 34afec0b..f9a891df 100644 Binary files a/services/transfer/transfer.pvm and b/services/transfer/transfer.pvm differ diff --git a/services/transfer/transfer.txt b/services/transfer/transfer.txt new file mode 100644 index 00000000..a22c1028 --- /dev/null +++ b/services/transfer/transfer.txt @@ -0,0 +1,40 @@ +// RO data = 0/0 bytes +// RW data = 0/0 bytes +// Stack size = 8192 bytes +// Jump table entry point size = 0 bytes +// RO data = [] +// RW data = [] +// Instructions = 23 +// Code size = 84 bytes + + : @0 + 0: 28 11 00 00 00 jump @4 + : @1 + 5: 28 10 00 00 00 jump @5 + : @2 + 10: 28 1c 00 00 00 jump @6 + : @3 + 15: 28 41 jump @7 + : @4 [export #0: 'is_authorized'] + 17: 33 07 a0 = 0x0 + 19: 32 00 ret + : @5 [export #1: 'refine'] + 21: 14 0a 04 00 ff fe 00 00 00 00 a3 = 0xfeff0004 + 31: 33 0b 08 a4 = 0x8 + 34: 33 07 a0 = 0x0 + 36: 32 00 ret + : @6 [export #2: 'accumulate'] + 38: 95 11 f8 sp = sp - 8 + 41: 7b 10 u64 [sp] = ra + 43: 14 08 00 00 ff fe 00 00 00 00 a1 = 0xfeff0000 + 53: 80 87 a0 = u32 [a1] + 55: 80 88 04 a1 = u32 [a1 + 4] + 58: 14 0a 00 e0 fd fe 00 00 00 00 a3 = 0xfefde000 + 68: 33 09 64 a2 = 0x64 + 71: 0a 0b ecalli 11 // 'transfer' + 73: 82 10 ra = u64 [sp] + 75: 95 11 08 sp = sp + 0x8 + 78: 32 00 ret + : @7 [export #3: 'on_transfer'] + 80: 33 07 a0 = 0x0 + 82: 32 00 ret \ No newline at end of file diff --git a/services/transfer/transfer_blob.pvm b/services/transfer/transfer_blob.pvm index 5c29200e..df12aec3 100644 Binary files a/services/transfer/transfer_blob.pvm and b/services/transfer/transfer_blob.pvm differ diff --git a/services/tribonacci/src/main.rs b/services/tribonacci/src/main.rs index b046b519..6d0be17b 100644 --- a/services/tribonacci/src/main.rs +++ b/services/tribonacci/src/main.rs @@ -18,64 +18,12 @@ fn panic(_info: &core::panic::PanicInfo) -> ! { #[polkavm_derive::polkavm_import] extern "C" { - #[polkavm_import(index = 0)] - pub fn gas() -> i64; - #[polkavm_import(index = 1)] - pub fn lookup(service: u32, hash_ptr: *const u8, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 2)] - pub fn read(service: u32, key_ptr: *const u8, key_len: u32, out: *mut u8, out_len: u32) -> u32; - // #[polkavm_import(index = 3)] - // pub fn write(key_ptr: *const u8, key_len: u32, value: *const u8, value_len: u32) -> u32; - #[polkavm_import(index = 3)] pub fn write(ko: u32, kz: u32, bo: u32, bz: u32) -> u32; - - #[polkavm_import(index = 4)] - pub fn info(service: u32, out: *mut u8) -> u32; - #[polkavm_import(index = 5)] - pub fn empower(m: u32, a: u32, v: u32, o: u32, n: u32) -> u32; - #[polkavm_import(index = 6)] - pub fn assign(c: u32, out: *mut u8) -> u32; - #[polkavm_import(index = 7)] - pub fn designate(out: *mut u8) -> u32; - #[polkavm_import(index = 8)] - pub fn checkpoint() -> u64; - #[polkavm_import(index = 9)] - pub fn new(service: u32, hash_ptr: *const u8, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 10)] - pub fn upgrade(out: *const u8, g: u64, m: u64) -> u32; - #[polkavm_import(index = 11)] - pub fn transfer(d: u32, a: u64, g: u64, out: *mut u8) -> u32; - #[polkavm_import(index = 12)] - pub fn quit(d: u32, a: u64, g: u64, out: *mut u8) -> u32; - #[polkavm_import(index = 13)] - pub fn solicit(hash_ptr: *const u8, z: u32) -> u32; - #[polkavm_import(index = 14)] - pub fn forget(hash_ptr: *const u8, z: u32) -> u32; - #[polkavm_import(index = 15)] - pub fn historical_lookup(service: u32, hash_ptr: *const u8, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 16)] - pub fn import(import_index: u32, out: *mut u8, out_len: u32) -> u32; - #[polkavm_import(index = 17)] - pub fn export(out: *const u8, out_len: u32) -> u32; #[polkavm_import(index = 18)] - pub fn machine(out: *const u8, out_len: u32) -> u32; + pub fn import(import_index: u32, out: *mut u8, out_len: u32) -> u32; #[polkavm_import(index = 19)] - pub fn peek(out: *const u8, out_len: u32, i: u32) -> u32; - #[polkavm_import(index = 20)] - pub fn poke(n: u32, a: u32, b: u32, l: u32) -> u32; - #[polkavm_import(index = 21)] - pub fn invoke(n: u32, out: *mut u8) -> u32; - #[polkavm_import(index = 22)] - pub fn expunge(n: u32) -> u32; - #[polkavm_import(index = 99)] - pub fn blake2b(data: *const u8, data_len: u32, hash_ptr: *mut u8) -> u32; - #[polkavm_import(index = 100)] - pub fn blake2s(data: *const u8, data_len: u32, hash_ptr: *mut u8) -> u32; - #[polkavm_import(index = 101)] - pub fn ecrecover(h: *const u8, v: *const u8, r: *const u8, s: *const u8, out: *mut u8) -> u32; - #[polkavm_import(index = 102)] - pub fn sha2_256(data: *const u8, data_len: u32, hash_ptr: *mut u8) -> u32; + pub fn export(out: *const u8, out_len: u32) -> u32; } #[polkavm_derive::polkavm_export] diff --git a/services/tribonacci/tribonacci.pvm b/services/tribonacci/tribonacci.pvm index 20d53c64..9ecf4e0d 100644 Binary files a/services/tribonacci/tribonacci.pvm and b/services/tribonacci/tribonacci.pvm differ diff --git a/services/tribonacci/tribonacci.txt b/services/tribonacci/tribonacci.txt index 7281edfc..45862a96 100644 --- a/services/tribonacci/tribonacci.txt +++ b/services/tribonacci/tribonacci.txt @@ -19,19 +19,19 @@ 18: 33 07 a0 = 0x0 20: 32 00 ret : @5 [export #1: 'refine'] - 22: 8b 11 d8 i64 sp = i64 sp - i64 40 - 25: 71 10 20 u64 [sp + 32] = ra - 28: 71 15 18 u64 [sp + 24] = s0 - 31: 71 16 10 u64 [sp + 16] = s1 + 22: 95 11 d8 sp = sp - 40 + 25: 7b 10 20 u64 [sp + 32] = ra + 28: 7b 15 18 u64 [sp + 24] = s0 + 31: 7b 16 10 u64 [sp + 16] = s1 34: 49 11 08 u64 [sp + 8] = 0 37: 49 01 u64 [sp + 0] = 0 39: 64 18 a1 = sp 41: 33 09 10 a2 = 0x10 44: 33 07 a0 = 0x0 - 46: 0a 10 ecalli 16 // 'import' + 46: 0a 12 ecalli 18 // 'import' 48: 01 fallthrough : @6 - 49: 79 77 a0 = a0 + 0x0 + 49: 83 77 i32 a0 = a0 + 0x0 51: 51 07 0f jump @8 if a0 == 0 : @7 54: 33 07 a0 = 0x0 @@ -40,46 +40,46 @@ 61: 33 09 01 a2 = 0x1 64: 28 17 jump @9 : @8 - 66: 77 17 04 a0 = i32 [sp + 4] - 69: 77 18 08 a1 = i32 [sp + 8] - 72: 77 19 0c a2 = i32 [sp + 12] - 75: 77 1a a3 = i32 [sp] - 77: b4 78 0b i64 a4 = a1 + a0 - 80: aa b9 09 a2 = a2 + a4 - 83: 79 aa 01 a3 = a3 + 0x1 + 66: 81 17 04 a0 = i32 [sp + 4] + 69: 81 18 08 a1 = i32 [sp + 8] + 72: 81 19 0c a2 = i32 [sp + 12] + 75: 81 1a a3 = i32 [sp] + 77: c8 78 0b a4 = a1 + a0 + 80: be b9 09 i32 a2 = a2 + a4 + 83: 83 aa 01 i32 a3 = a3 + 0x1 86: 01 fallthrough : @9 - 87: 70 1a u32 [sp] = a3 - 89: 70 19 04 u32 [sp + 4] = a2 - 92: 70 17 08 u32 [sp + 8] = a0 - 95: 70 18 0c u32 [sp + 12] = a1 + 87: 7a 1a u32 [sp] = a3 + 89: 7a 19 04 u32 [sp + 4] = a2 + 92: 7a 17 08 u32 [sp + 8] = a0 + 95: 7a 18 0c u32 [sp + 12] = a1 98: 64 15 s0 = sp 100: 33 06 10 s1 = 0x10 103: 64 17 a0 = sp 105: 33 08 10 a1 = 0x10 - 108: 0a 11 ecalli 17 // 'export' + 108: 0a 13 ecalli 19 // 'export' 110: 64 5a a3 = s0 112: 64 6b a4 = s1 114: 33 07 a0 = 0x0 - 116: 78 10 20 ra = u64 [sp + 32] - 119: 78 15 18 s0 = u64 [sp + 24] - 122: 78 16 10 s1 = u64 [sp + 16] - 125: 8b 11 28 i64 sp = i64 sp + 0x28 + 116: 82 10 20 ra = u64 [sp + 32] + 119: 82 15 18 s0 = u64 [sp + 24] + 122: 82 16 10 s1 = u64 [sp + 16] + 125: 95 11 28 sp = sp + 0x28 128: 32 00 ret : @10 [export #2: 'accumulate'] - 130: 8b 11 f0 i64 sp = i64 sp - i64 16 - 133: 71 10 08 u64 [sp + 8] = ra + 130: 95 11 f0 sp = sp - 16 + 133: 7b 10 08 u64 [sp + 8] = ra 136: 46 11 07 u8 [sp + 7] = 0 - 139: 8b 17 07 i64 a0 = i64 sp + 0x7 - 142: 8d 77 20 a0 = a0 <<64 32 - 145: 8e 77 20 a0 = a0 >>64 32 + 139: 95 17 07 a0 = sp + 0x7 + 142: 97 77 20 a0 = a0 << 32 + 145: 98 77 20 a0 = a0 >> 32 148: 14 09 00 00 ff fe 00 00 00 00 a2 = 0xfeff0000 158: 33 08 01 a1 = 0x1 161: 33 0a 0c a3 = 0xc 164: 0a 03 ecalli 3 // 'write' 166: 33 07 a0 = 0x0 - 168: 78 10 08 ra = u64 [sp + 8] - 171: 8b 11 10 i64 sp = i64 sp + 0x10 + 168: 82 10 08 ra = u64 [sp + 8] + 171: 95 11 10 sp = sp + 0x10 174: 32 00 ret : @11 [export #3: 'on_transfer'] 176: 33 07 a0 = 0x0 diff --git a/services/tribonacci/tribonacci_blob.pvm b/services/tribonacci/tribonacci_blob.pvm index 4ce44ace..4ab4d8dd 100644 Binary files a/services/tribonacci/tribonacci_blob.pvm and b/services/tribonacci/tribonacci_blob.pvm differ