0xPolygon / storage-delta

Real-time smart contract storage auditor.
Apache License 2.0
30 stars 4 forks source link

Add hot-reload #12

Open ZeroEkkusu opened 10 months ago

ZeroEkkusu commented 10 months ago

As demoed in the readme.

kamuik16 commented 9 months ago

As demoed in the readme.

Hey @ZeroEkkusu! I tried to implement this!

So, the main tweak I made was adding this inotifywait loop to the shell script. This bit keeps an eye on all .sol files in the src folder and its subfolders. Whenever you make a change to any of these files, the script kicks into action and automatically updates the report, using the same commit reference you initially gave it.

Is this something you had in mind? If you'd like to see the changes see here.

ZeroEkkusu commented 9 months ago

This looks like hot-reload 🔥

I haven't had a chance to dive into the code, but can give some feedback based on what I've noticed:

  1. I see the subdirectory mentioned - does it mean it doesn't detect deeper than that?
  2. If possible, we should get the name of the file that has been created/modified/deleted and re-run the tool only for that file. The reason for this is that if the codebase is large, hot-reload will be slow if we have to re-analyze all files. May be easier to create a mini function that mimics run.sh to use for that?
kamuik16 commented 9 months ago

This looks like hot-reload 🔥

I haven't had a chance to dive into the code, but can give some feedback based on what I've noticed:

  1. I see the subdirectory mentioned - does it mean it doesn't detect deeper than that?
  2. If possible, we should get the name of the file that has been created/modified/deleted and re-run the tool only for that file. The reason for this is that if the codebase is large, hot-reload will be slow if we have to re-analyze all files. May be easier to create a mini function that mimics run.sh to use for that?

I have tried to implement the above suggesstions here. Let me know what you think about this.

ZeroEkkusu commented 9 months ago

Hey, @kamuik16,

I was away, so I didn't get a chance to respond - sorry about that.

Thank you, I'll ping you after I take a look!

kamuik16 commented 9 months ago

Hey, @kamuik16,

I was away, so I didn't get a chance to respond - sorry about that.

Thank you, I'll ping you after I take a look!

Hey @ZeroEkkusu! Good to see you back! I have just pushed the recent changes and can open a draft PR regarding this so you can also suggest/make changes. I also opened https://github.com/0xPolygon/storage-delta/pull/19 PR suggesting a new feature if this is something you'd like to see.

ZeroEkkusu commented 9 months ago

Looking good so far - let's create a PR to do a proper review!

kamuik16 commented 9 months ago

Looking good so far - let's create a PR to do a proper review!

Opened a Draft PR https://github.com/0xPolygon/storage-delta/pull/20.