near-explorer icon indicating copy to clipboard operation
near-explorer copied to clipboard

Feature Request: Download state, contract code and vm_context from explorer

Open ailisp opened this issue 3 years ago • 4 comments

This is as shared Q2 OKR between public node interface and we contract runtime team. The high level requirement is to show "download state", "download contract code" on every function call kind of transaction page and "download vm context" on every function call action section.

With these three downloaded, user will be able to locally reproduce any function call transaction locally. Take a look at https://gist.github.com/ailisp/db1e3bb5c0513ae19cf2ac0b6be75575 to have an idea on how these download and repro works manually. This working item for explorer team would be implement these download functionality and show in explorer frontend. We contract runtime team will make "local repro given downloaded state/code/context" more developer friendly.

ailisp avatar Apr 08 '21 23:04 ailisp

Depending on how state downloading is implemented, this may potentially lead to dos attacks. @frol

bowenwang1996 avatar Apr 09 '21 14:04 bowenwang1996

Depending on how state downloading is implemented, this may potentially lead to dos attacks. @frol

This is a devops problem can be protected in typical web app way: only allow request internal near node via explorer backend, add rate limit per frontend ip, and when rate limit hits slow down user's download by showing a captcha

ailisp avatar Apr 09 '21 16:04 ailisp

"download vm context"

Can we reconstruct it from a receipt and a block header? Do we need to extend nearcore to provide something else?

We contract runtime team will make "local repro given downloaded state/code/context" more developer friendly.

Given that you will build a tool for local execution, it can include the download subcommands (for cases when state is smaller than 50kb), right? I mean, surely Explorer also needs this piece in the future, I just want to make sure you are not blocked on Explorer implementation since this feature has not been our priority.

frol avatar Apr 12 '21 15:04 frol

Can we reconstruct it from a receipt and a block header? Do we need to extend nearcore to provide something else?

Just checked seems everything is available, just scattered in different rpc

Given that you will build a tool for local execution, it can include the download subcommands (for cases when state is smaller than 50kb), right? I mean, surely Explorer also needs this piece in the future, I just want to make sure you are not blocked on Explorer implementation since this feature has not been our priority.

Yeah make sense, so these are two tasks. First we would need make enough information available via RPC. Second one would expose this to explorer or part of local tool subcommand

ailisp avatar Apr 12 '21 21:04 ailisp