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

fix: Updated to use ethers-rs #8

Merged
merged 4 commits into from
Feb 14, 2024
Merged

fix: Updated to use ethers-rs #8

merged 4 commits into from
Feb 14, 2024

Conversation

Maikol
Copy link
Member

@Maikol Maikol commented Feb 8, 2024

Dependency changes

Removed dependencies:

eip-712-derive
solidity-bindgen
web3

Added dependencies:

ethers
url

Code changes

Config changes

Removed the ORACLE_CONTRACTS env variable. This was used to get the network name, chain id, contracts addresses and RPC url. Value was split with a : so you had to pass sepolia:RPC_URL. Replaced this with two variables REWARDS_MANAGER_CONTRACT and RPC_URL. We only really need the rewards manager address so by doing this change we can remove all contract configs and if we need to run on a different network we just need to pass the contract address and url, no need for code changes. We are also getting the chain id from the provider so we removed common/src/chain_id.rs since we no longer need it.

Contract interactions

By switching from solidity-bindgen to ethers-rs we can get rid of over 8k lines in common/src/contracts/abis.rs and only import availability-oracle/src/abi/RewardsManager.abi.json which is what we want to interact with. We're also simulating the transaction to check of errors and if we detect one we log the revert reason.

Copy link

gitguardian bot commented Feb 8, 2024

⚠️ GitGuardian has uncovered 5 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
8215355 Triggered Generic High Entropy Secret e3bff41 common/src/contracts/config.rs View secret
8215358 Triggered Generic High Entropy Secret e3bff41 common/src/contracts/config.rs View secret
8215360 Triggered Generic High Entropy Secret e3bff41 common/src/contracts/config.rs View secret
8215361 Triggered Generic High Entropy Secret e3bff41 common/src/contracts/config.rs View secret
8215365 Triggered Generic High Entropy Secret e3bff41 common/src/contracts/config.rs View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

Copy link
Member

@Theodus Theodus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just some suggestions

availability-oracle/src/main.rs Outdated Show resolved Hide resolved
tokio = { version="1.10", features=["sync", "time"] }
web3 = "0.16.0"
solidity-bindgen = "0.1.0"
tokio = { version="1.10", features=["sync", "time", "rt-multi-thread"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a separate PR: probably a good idea to upgrade these dependencies. I typically check for the latest versions with cargo-outdated (cargo outdated -R)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely, I'll do it as a new PR.

Screenshot 2024-02-08 at 14 51 40

@Maikol Maikol merged commit d398b9f into main Feb 14, 2024
3 of 4 checks passed
@Maikol Maikol deleted the mde/updated-to-use-ethers-rs branch February 14, 2024 17:29
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

Successfully merging this pull request may close these issues.

None yet

2 participants