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

srcmap-runtime is inaccurate #82

Open
duytai opened this issue May 17, 2020 · 7 comments
Open

srcmap-runtime is inaccurate #82

duytai opened this issue May 17, 2020 · 7 comments
Labels
bug Something isn't working remix-ide

Comments

@duytai
Copy link

duytai commented May 17, 2020

Description

srcmap-runtime is inaccurate

Environment

  • Compiler version: 0.5.10+commit.5a6ea5b1.Linux.g++
  • Target EVM version (as per compiler settings):
  • Framework/IDE (e.g. Truffle or Remix):
  • EVM execution environment / backend / blockchain client:
  • Operating system: Ubuntu

Steps to Reproduce

I use the below command to get get srcmap-runtime of smart contract RampInstantTokenPool(https://etherscan.io/address/0x85e112e0f75f2b4751a647b81fcbca3bb3c78f84#code)

solc --combined-json bin-runtime,srcmap-runtime RampInstantTokenPool.sol

After that, I decompress srcmap-runtime and try to print out all mappings from bytecode to source code. Some mapped code are incomplete. For example:

equire(msg.sender == owner, "only the owner can call this");

It must be

require(msg.sender == owner, "only the owner can call this");

here is decompress srcmap code snippet:

decompress(srcmap) {
    return srcmap
      .split(';')
      .reduce((result, slfj) => {
        const [s, l, f, j] = slfj.split(':')
        const [last] = result.slice(-1)
        return result.concat({
          s: s ? parseInt(s, 10) : last.s,
          l: l ? parseInt(l, 10) : last.l,
          f: f ? parseInt(f, 10) : last.f,
          j: j || last.j,
        })
      }, [])
  }
@chriseth
Copy link
Contributor

Confirmed, all start and end locations seem to be off by one for this contract in remix when using the "copy to clipboard" feature of etherscan. Other contracts are fine. My guess would be that this is due to a two-byte unicode character.

@chriseth
Copy link
Contributor

Ah, ok, it seems to be the copyright symbol. Could be a duplicate of ethereum/solidity#4614

@Marenz
Copy link

Marenz commented May 20, 2020

I can confirm that the copyright sign is causing this.

@Marenz
Copy link

Marenz commented May 20, 2020

I also think this is a duplicate of ethereum/solidity#4614 and will close this one in favor of the other.

@Marenz Marenz closed this as completed May 20, 2020
@chriseth chriseth transferred this issue from ethereum/solidity May 20, 2020
@chriseth chriseth reopened this May 20, 2020
@chriseth
Copy link
Contributor

It seems that remix uses character counts for source references instead of byte amounts - is that correct?

@yann300
Copy link
Contributor

yann300 commented May 20, 2020

yes we use character counts, we could work with bytes but not sure if the editor is directly handling it and if not we would need to process and parse the source I guess.

@chriseth
Copy link
Contributor

I still think byte count is the better metric because it is independent of the encoding (which is not really specified) and all the weird unicode effects.

@LianaHus LianaHus transferred this issue from ethereum/remix-ide Jul 27, 2020
@LianaHus LianaHus added bug Something isn't working remix-ide labels Jul 27, 2020
ioedeveloper pushed a commit that referenced this issue Sep 29, 2020
Warn that the sharedFolder changed
jimni1222 pushed a commit to jimni1222/remix-project that referenced this issue Dec 15, 2021
bunsenstraat added a commit that referenced this issue Oct 20, 2023
# This is the 1st commit message:

uml

# This is the commit message #2:

setvalue fix

# This is the commit message #3:

fix unit test

# This is the commit message #4:

special functions

# This is the commit message #5:

fix value

# This is the commit message #6:

lint

# This is the commit message #7:

statuc

# This is the commit message #8:

api  test

# This is the commit message #9:

port

# This is the commit message #10:

etherscan

# This is the commit message #11:

rm fc

# This is the commit message #12:

tooltip

# This is the commit message #13:

lock

# This is the commit message #14:

screenshots

# This is the commit message #15:

pause test

# This is the commit message #16:

getbrowser

# This is the commit message #17:

logs

# This is the commit message #18:

log env

# This is the commit message #19:

logs

# This is the commit message #20:

test

# This is the commit message #21:

nx url

# This is the commit message #22:

127.0.0.1

# This is the commit message #23:

rm log

# This is the commit message #24:

etherscan

# This is the commit message #25:

.frameParent()

# This is the commit message #26:

retry

# This is the commit message #27:

set flaky

# This is the commit message #28:

flaky

# This is the commit message #29:

logs

# This is the commit message #30:

launch

# This is the commit message #31:

more logs

# This is the commit message #32:

etherscan

# This is the commit message #33:

rm flaky

# This is the commit message #34:

hardhat

# This is the commit message #35:

hardhat

# This is the commit message #36:

hardhat

# This is the commit message #37:

hardhat

# This is the commit message #38:

term

# This is the commit message #39:

screeenshots

# This is the commit message #40:

pause

# This is the commit message #41:

look for gas

# This is the commit message #42:

fix test

# This is the commit message #43:

load compiler

# This is the commit message #44:

force compile

# This is the commit message #45:

logs

# This is the commit message #46:

imeout

# This is the commit message #47:

add pause

# This is the commit message #48:

change contract

# This is the commit message #49:

pause

# This is the commit message #50:

rm extra compile

# This is the commit message #51:

20

# This is the commit message #52:

compile again

# This is the commit message #53:

logs

# This is the commit message #54:

revert

# This is the commit message #55:

rm screens

# This is the commit message #56:

rm logs

# This is the commit message #57:

flaky off

# This is the commit message #58:

resize

# This is the commit message #59:

zoom test

# This is the commit message #60:

flaky

# This is the commit message #61:

test

# This is the commit message #62:

nx_npm

# This is the commit message #63:

flaky

# This is the commit message #64:

log more

# This is the commit message #65:

group it

# This is the commit message #66:

storage

# This is the commit message #67:

some logs

# This is the commit message #68:

look at solidity

# This is the commit message #69:

autocompile

# This is the commit message #70:

test the tooltips off

# This is the commit message #71:

click compile

# This is the commit message #72:

logs

# This is the commit message #73:

show the logs

# This is the commit message #74:

await

# This is the commit message #75:

string the errors

# This is the commit message #76:

log all

# This is the commit message #77:

more log

# This is the commit message #78:

more logs

# This is the commit message #79:

more logs

# This is the commit message #80:

log error

# This is the commit message #81:

log more

# This is the commit message #82:

log more

# This is the commit message #83:

fix timestamp

# This is the commit message #84:

logging

# This is the commit message #85:

dont set null

# This is the commit message #86:

smaller than

# This is the commit message #87:

logs

# This is the commit message #88:

hover test

# This is the commit message #89:

flaky terminal

# This is the commit message #90:

terminal

# This is the commit message #91:

merge group

# This is the commit message #92:

config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working remix-ide
Projects
None yet
Development

No branches or pull requests

5 participants