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

Replayer should supply block specific context to transactions #3

Open
frankbraun opened this issue Feb 25, 2021 · 5 comments
Open

Replayer should supply block specific context to transactions #3

frankbraun opened this issue Feb 25, 2021 · 5 comments
Assignees

Comments

@frankbraun
Copy link
Contributor

@djsatok brought up the issue on Discord that smart contracts can use block.timestamp and if that doesn't match a replayed transaction will fail.

It's even worse then that, all of the following could potentially be used:

  • block.coinbase
  • block.timestamp
  • block.number
  • block.difficulty
  • block.gaslimit
  • hash = block.blockHash(blockNumber) (hash of the specific block, only valid for the 256 most recent blocks, excluding the current one)

See EVM Opcodes.

After discussion with @artob, taking into consideration that the EVM will now mostly be implemented as a smart contract, we agreed that the best approach would be to extend the near-web3-provider API with a something like Eth.send_raw_transaction_with_context. Similar to Eth.send_raw_transaction, but also passing in the necessary block context to execute the transaction within a test contract deployment of the EVM.

That way, in combination with issue #2, we should be able to replay all transactions of an Ethereum testnet to a NEAR EVM test deployment.

@frankbraun frankbraun self-assigned this Feb 25, 2021
@alexauroradev
Copy link

@frankbraun , one important thing would be to guard Eth.send_raw_transaction_with_context, and most importantly, corresponding EVM contract method with a #feature[bully], which will be used only for stress-testing and will never be deployed in production environment.

@frankbraun
Copy link
Contributor Author

@djsatok: Yes, absolutely. I think we should stress test on betanet that way, maybe on testnet (to be determined), but the corresponding functionality (in nearcore and near-web3-provider) should never be activated on mainnet.

frankbraun pushed a commit that referenced this issue Feb 26, 2021
frankbraun pushed a commit that referenced this issue Feb 26, 2021
@frankbraun
Copy link
Contributor Author

The block context is now prepared by the replayer.

@frankbraun
Copy link
Contributor Author

See also aurora-is-near/aurora-engine#2

@artob
Copy link

artob commented Mar 12, 2021

As described in aurora-is-near/aurora-engine#1 (comment) and aurora-is-near/aurora-engine#2 (comment), the EVM contract is now ready to begin accepting begin_chain and begin_block calls. The implementation of those functions is a work in progress, but they can be called already, unblocking the Bully to proceed calling them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants