npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

solcasm2

v1.0.3

Published

This assembler is able to convert the EVM assembly dialect that has been generated by `solc` into valid EVM bytecode.

Downloads

14

Readme

solcasm (evm-assembler)

This assembler is able to convert the EVM assembly dialect that has been generated by solc into valid EVM bytecode.

Note: This project has been initially forked from RafaelSalguero/evm-assembler at commit 9944664.

Install it

yarn add solcasm2

or

npm i solcasm2

solc --asm compatible assembler

1.- Write EVM assembly in the same format as solc --asm output or convert your Solidity code into this EVM assembly dialect.

  mstore(0x40, 0x80)
  callvalue
  dup1
  iszero
  tag_1
  jumpi
  0x00
  dup1
  revert
tag_1:
  pop
  dataSize(sub_0)
  dup1
  dataOffset(sub_0)
  0x00
  codecopy
  0x00
  return
stop

sub_0: assembly {
      mstore(0x40, 0x80)
}

2.- Compile it

npx solcasm2 contract.evm contract.bin

output:

6080604052348015600f57600080fd5b50600580601d6000396000f3006080604052

Helper Functions

This assembler supports several custom helper functions that are resolved to valid opcodes and thus valid bytecode at compile time. The following chapters explain those utilitiy functions.

Stack Peek (stack_peek_1 to stack_peek_12)

The stack_peek_* helper functions can be used to inspect the stack during execution. The function will write the stack element at the specfied stack position to the log. Speeking in Solidity, this is similar to emitting the following event: Stackpeek(uint256 pos, bytes32 data). Since this also writes to memory, it might overwrite data in memory that has already been stored there from previous steps, leading to an error in the following executions. Thus, it is recommended to add a stop after calling stack_peek_* or serveral stack_peek_* commands to halt the execution after the stack was inspected. Since this function was designed for debugging sessions, stopping after logging the stack should not be an issue. Right now, this only supports inspecting the first 12 (of 16) stack elements (stack_peek_1 to stack_peek_12). The reason is, that we need to have space on the stack for the logging an returning to the calling position after the logging (the first 4 stack elements in the stack_peek_* are reserved for this functionality) (dev note: maybe we could swap the data we need for logging and routine returning temporarly to memory in order access the full stack.).

Example:

0x01
0x02
stack_peek_1
stack_peek_2
stop

would lead to the following logging (events):

0x00000000000000000000000000000001 0x00000000000000000000000000000002
0x00000000000000000000000000000002 0x00000000000000000000000000000001