Skip to content

Update solidity-support: block.coinbase and block.difficulty #351

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

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arbitrum-docs/solidity-support.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Arbitrum Nitro chains are Ethereum compatible, and therefore allow you to trustl
Although Arbitrum supports Solidity code, there are differences in the effects of a few operations, including language features that don't make much sense in the Layer 2 context:

- `blockhash(x)` returns a cryptographically insecure, pseudo-random hash for `x` within the range `block.number - 256 <= x < block.number`. If `x` is outside of this range, `blockhash(x)` will return `0`. This includes `blockhash(block.number)`, which always returns `0` just like on Ethereum. The hashes returned do not come from L1.
- `block.coinbase` returns zero
- `block.difficulty` and `block.prevrandao` returns the constant 2500000000000000
- `block.coinbase` returns the designated internal address 0xA4b000000000000000000073657175656e636572 if the message was posted by a Sequencer. It it's a delayed message, it returns the address of the delayed message's poster (Note: the handling of delayed message's `block.coinbase` will likely be changed in ArbOS v11).
- `block.difficulty` and `block.prevrandao` returns the constant 1
- `block.number` return an "estimate" of the L1 block number at which the Sequencer received the transaction (see [Block Numbers and Time](./time.mdx))
- `msg.sender` works the same way it does on Ethereum for normal L2-to-L2 transactions; for L1-to-L2 "retryable ticket" transactions, it will return the L2 address alias of the L1 contract that triggered the message. See [retryable ticket address aliasing](./arbos/l1-to-l2-messaging#address-aliasing) for more.
- OPCODE `push0` is not yet supported, but will soon be available. This means that solidity version `0.8.20` or higher can only be used with an evm-version lower than the default `shanghai` ([see instructions here](https://docs.soliditylang.org/en/v0.8.20/using-the-compiler.html#setting-the-evm-version-to-target) to change that parameter in solc, or [here](https://hardhat.org/hardhat-runner/docs/guides/compile-contracts#configuring-the-compiler) to set the `solidity` or `evmVersion` configuration parameters in hardhat). Versions up to `0.8.19` (included) are fully compatible.