ethereum / sourcify

Decentralized Solidity contract source code verification service
https://sourcify.dev
MIT License
768 stars 378 forks source link

Add chain 48795 8227 11227 #1434

Closed nstamm10 closed 2 months ago

nstamm10 commented 2 months ago

Add New Chain

Thanks for your pull request to add a new support in Sourcify.

If you haven't done so, please follow the instructions on how to request chain support in docs.

Please check the following items before submitting your pull request for a speedy review.

Checklist

nstamm10 commented 2 months ago

Just updated the metadata with calculated metadata using the solc compiler, but looks like tests are still failing.

manuelwedler commented 2 months ago

How did you use solc? What was the input and arguments?

I just tried it myself with solc-linux-amd64-v0.8.12+commit.f00d7308. I compiled the services/server/test/chains/sources/11227/Multicall3.sol from your branch and this is my Metadata file:

{"compiler":{"version":"0.8.12+commit.f00d7308"},"language":"Solidity","output":{"abi":[{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"aggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"allowFailure","type":"bool"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call3[]","name":"calls","type":"tuple[]"}],"name":"aggregate3","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"allowFailure","type":"bool"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call3Value[]","name":"calls","type":"tuple[]"}],"name":"aggregate3Value","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"blockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getBasefee","outputs":[{"internalType":"uint256","name":"basefee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockNumber","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"chainid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockCoinbase","outputs":[{"internalType":"address","name":"coinbase","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockDifficulty","outputs":[{"internalType":"uint256","name":"difficulty","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockGasLimit","outputs":[{"internalType":"uint256","name":"gaslimit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockTimestamp","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getEthBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"tryAggregate","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"tryBlockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"}],"devdoc":{"author":"Michael Elliot <mike@makerdao.com>Joshua Levine <joshua@makerdao.com>Nick Johnson <arachnid@notdot.net>Andreas Bigger <andreas@nascent.xyz>Matt Solomon <matt@mattsolomon.dev>","details":"Multicall & Multicall2 backwards-compatibleAggregate methods are marked `payable` to save 24 gas per call","kind":"dev","methods":{"aggregate((address,bytes)[])":{"params":{"calls":"An array of Call structs"},"returns":{"blockNumber":"The block number where the calls were executed","returnData":"An array of bytes containing the responses"}},"aggregate3((address,bool,bytes)[])":{"params":{"calls":"An array of Call3 structs"},"returns":{"returnData":"An array of Result structs"}},"aggregate3Value((address,bool,uint256,bytes)[])":{"params":{"calls":"An array of Call3Value structs"},"returns":{"returnData":"An array of Result structs"}},"blockAndAggregate((address,bytes)[])":{"params":{"calls":"An array of Call structs"},"returns":{"blockHash":"The hash of the block where the calls were executed","blockNumber":"The block number where the calls were executed","returnData":"An array of Result structs"}},"getBlockHash(uint256)":{"params":{"blockNumber":"The block number"}},"tryAggregate(bool,(address,bytes)[])":{"params":{"calls":"An array of Call structs","requireSuccess":"If true, require all calls to succeed"},"returns":{"returnData":"An array of Result structs"}},"tryBlockAndAggregate(bool,(address,bytes)[])":{"params":{"calls":"An array of Call structs"},"returns":{"blockHash":"The hash of the block where the calls were executed","blockNumber":"The block number where the calls were executed","returnData":"An array of Result structs"}}},"title":"Multicall3","version":1},"userdoc":{"kind":"user","methods":{"aggregate((address,bytes)[])":{"notice":"Backwards-compatible call aggregation with Multicall"},"aggregate3((address,bool,bytes)[])":{"notice":"Aggregate calls, ensuring each returns success if required"},"aggregate3Value((address,bool,uint256,bytes)[])":{"notice":"Aggregate calls with a msg valueReverts if msg.value is less than the sum of the call values"},"blockAndAggregate((address,bytes)[])":{"notice":"Backwards-compatible with Multicall2Aggregate calls and allow failures using tryAggregate"},"getBasefee()":{"notice":"Gets the base fee of the given blockCan revert if the BASEFEE opcode is not implemented by the given chain"},"getBlockHash(uint256)":{"notice":"Returns the block hash for the given block number"},"getBlockNumber()":{"notice":"Returns the block number"},"getChainId()":{"notice":"Returns the chain id"},"getCurrentBlockCoinbase()":{"notice":"Returns the block coinbase"},"getCurrentBlockDifficulty()":{"notice":"Returns the block difficulty"},"getCurrentBlockGasLimit()":{"notice":"Returns the block gas limit"},"getCurrentBlockTimestamp()":{"notice":"Returns the block timestamp"},"getEthBalance(address)":{"notice":"Returns the (ETH) balance of a given address"},"getLastBlockHash()":{"notice":"Returns the block hash of the last block"},"tryAggregate(bool,(address,bytes)[])":{"notice":"Backwards-compatible with Multicall2Aggregate calls without requiring success"},"tryBlockAndAggregate(bool,(address,bytes)[])":{"notice":"Backwards-compatible with Multicall2Aggregate calls and allow failures using tryAggregate"}},"notice":"Aggregate results from multiple function calls","version":1}},"settings":{"compilationTarget":{"/home/manuel/Projects/sourcify/sourcify/services/server/test/chains/sources/11227/Multicall3.sol":"Multicall3"},"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"/home/manuel/Projects/sourcify/sourcify/services/server/test/chains/sources/11227/Multicall3.sol":{"keccak256":"0xf7c6db8a2600e7c161722a8fb8fe5a4c56c1012bfaaa24dbd53c0a22ff698257","license":"MIT","urls":["bzz-raw://5f7005028e3fe2c8e877f86732520faeb1807bdda6e34c9ebbd157afaf1a4797","dweb:/ipfs/QmV26CJpkDfPk5RMvTi3NmkRkD8WtN25yWy2bqZc7C5EmQ"]}},"version":1}

I get the correct hash for the file, which is 0xf7c6db8a2600e7c161722a8fb8fe5a4c56c1012bfaaa24dbd53c0a22ff698257. The Metadata you provided include the hash 0x95dfd0a2dd6626c7119ff7c3f214d56b289145f81a0521cd93a6252a326966f6. Are you sure you uploaded the exact same file as the one you compiled?

nstamm10 commented 2 months ago

I used solc Multicall3.sol --metadata on the file and got that output. I am not sure what went wrong there, I will try with your version.

manuelwedler commented 2 months ago

I'm sorry, but if you use my metadata.json, you won't get a perfect match. The metadata hash will be different on-chain. You will need the exact same metadata that was generated for the actually deployed contract. You could deploy it again though.

Besides that, the test says now that there is no contract deployed at 0xD0bB2f670f8743E5eDA59C4AB746C5CC5132C7bb.

manuelwedler commented 2 months ago

@nstamm10 Could you please clean up this PR? We will close it in a week if it stays inactive

nstamm10 commented 2 months ago

Hey @manuelwedler, thanks for all the help. Unforunately, I did not deploy those contracts myself so I don't have the metadata. I will close and reopen when I have more information.

nstamm10 commented 2 months ago

Closing