Skip to content

Commit

Permalink
Merge pull request #268 from everx-labs/IgorKoval/ton
Browse files Browse the repository at this point in the history
ton opcodes
  • Loading branch information
tonjen authored Oct 8, 2024
1 parent 87706d3 commit 24c1773
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 5 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

All notable changes to this project will be documented in this file.

## Version 1.7.0

- Add ton commands.

## Version 1.6.3

- fix `parse_slice`


## Version 1.6.1

- Use modern crates anyhow and thiserror instead of failure
-
- Use modern crates `anyhow` and `thiserror` instead of `failure`

## Version 1.6.0

- fix `parse_slice_base`
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build = 'build.rs'
edition = '2021'
name = 'ever_assembler'
version = '1.6.22'
version = '1.7.0'

[dependencies]
anyhow = '1.0'
Expand Down
77 changes: 76 additions & 1 deletion src/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ impl Engine {
BREMBITS => 0xCF, 0x35
BREMBITREFS => 0xCF, 0x37
BREMREFS => 0xCF, 0x36
BURN => 0xFB, 0x09
BUYGAS => 0xF8, 0x02
CADR => 0x6F, 0xB4
CADDR => 0x6F, 0xD4
Expand Down Expand Up @@ -873,7 +872,81 @@ impl Engine {
BLS_G2_ISZERO => 0xF9, 0x30, 0x28
BLS_PAIRING => 0xF9, 0x30, 0x30
BLS_PUSHR => 0xF9, 0x30, 0x31
}

simple_commands! {
enumerate_ton_commands
STORAGEFEES => 0xF8, 0x2C
GASCONSUMED => 0xF8, 0x07
INCOMINGVALUE => 0xF8, 0x2B
DUEPAYMENT => 0xF8, 0x2F
SENDMSG => 0xFB, 0x08

MULADDDIVMOD => 0xA9, 0x80
MULADDDIVMODR => 0xA9, 0x81
MULADDDIVMODC => 0xA9, 0x82
QMULADDDIVMOD => 0xB7, 0xA9, 0x80
QMULADDDIVMODR => 0xB7, 0xA9, 0x81
QMULADDDIVMODC => 0xB7, 0xA9, 0x82

ADDDIVMOD => 0xA9, 0x00
ADDDIVMODR => 0xA9, 0x01
ADDDIVMODC => 0xA9, 0x02
QADDDIVMOD => 0xB7, 0xA9, 0x00
QADDDIVMODR => 0xB7, 0xA9, 0x01
QADDDIVMODC => 0xB7, 0xA9, 0x02

ADDRSHIFTMOD => 0xA9, 0x20
ADDRSHIFTMODR => 0xA9, 0x21
ADDRSHIFTMODC => 0xA9, 0x22
QADDRSHIFTMOD => 0xB7, 0xA9, 0x20
QADDRSHIFTMODR => 0xB7, 0xA9, 0x21
QADDRSHIFTMODC => 0xB7, 0xA9, 0x22

MULADDRSHIFTMOD => 0xA9, 0xA0
MULADDRSHIFTRMOD => 0xA9, 0xA1
MULADDRSHIFTCMOD => 0xA9, 0xA2
QMULADDRSHIFTMOD => 0xB7, 0xA9, 0xA0
QMULADDRSHIFTRMOD => 0xB7, 0xA9, 0xA1
QMULADDRSHIFTCMOD => 0xB7, 0xA9, 0xA2

LSHIFTADDDIVMOD => 0xA9, 0xC0
LSHIFTADDDIVMODR => 0xA9, 0xC1
LSHIFTADDDIVMODC => 0xA9, 0xC2
QLSHIFTADDDIVMOD => 0xB7, 0xA9, 0xC0
QLSHIFTADDDIVMODR => 0xB7, 0xA9, 0xC1
QLSHIFTADDDIVMODC => 0xB7, 0xA9, 0xC2

HASHEXT_SHA256 => 0xF9, 0x04, 0x00
HASHEXT_SHA512 => 0xF9, 0x04, 0x01
HASHEXT_BLAKE2B => 0xF9, 0x04, 0x02
HASHEXT_KECCAK256 => 0xF9, 0x04, 0x03
HASHEXT_KECCAK512 => 0xF9, 0x04, 0x04

ECRECOVER => 0xF9, 0x12

HASHEXTA_SHA256 => 0xF9, 0x06, 0x00
HASHEXTA_SHA512 => 0xF9, 0x06, 0x01
HASHEXTA_BLAKE2B => 0xF9, 0x06, 0x02
HASHEXTA_KECCAK256 => 0xF9, 0x06, 0x03
HASHEXTA_KECCAK512 => 0xF9, 0x06, 0x04

P256_CHKSIGNU => 0xF9, 0x14
P256_CHKSIGNS => 0xF9, 0x15

RIST255_FROMHASH => 0xF9, 0x20
RIST255_VALIDATE => 0xF9, 0x21
RIST255_ADD => 0xF9, 0x22
RIST255_SUB => 0xF9, 0x23
RIST255_MUL => 0xF9, 0x24
RIST255_MULBASE => 0xF9, 0x25
RIST255_PUSHL => 0xF9, 0x26

RIST255_QVALIDATE => 0xB7, 0xF9, 0x21
RIST255_QADD => 0xB7, 0xF9, 0x22
RIST255_QSUB => 0xB7, 0xF9, 0x23
RIST255_QMUL => 0xB7, 0xF9, 0x24
RIST255_QMULBASE => 0xB7, 0xF9, 0x25
}

fn add_commands<'a>(&mut self, iter: impl IntoIterator<Item = &'a (&'static str, CompileHandler)>) {
Expand All @@ -896,5 +969,7 @@ impl Engine {
self.add_commands(Self::enumerate_groth_commands());

self.add_commands(Self::enumerate_bls_commands());

self.add_commands(Self::enumerate_ton_commands());
}
}

0 comments on commit 24c1773

Please sign in to comment.