@@ -12,14 +12,12 @@ use alloy::{
1212 eips:: { eip4844:: BYTES_PER_BLOB , eip7594:: BlobTransactionSidecarEip7594 , Encodable2718 } ,
1313 hex,
1414 network:: EthereumWallet ,
15- primitives:: Address ,
15+ primitives:: { utils :: parse_ether , Address , U256 } ,
1616 providers:: { PendingTransactionError , Provider , ProviderBuilder } ,
1717 rpc:: types:: TransactionReceipt ,
1818 signers:: local:: LocalSigner ,
1919} ;
2020use config:: Config ;
21- use ethers:: types:: U256 ;
22- use ethers:: utils:: parse_ether;
2321use fetcher:: { ProofsFetcher , ProofsFetcherError } ;
2422use merkle_tree:: compute_proofs_merkle_root;
2523use risc0_ethereum_contracts:: encode_seal;
@@ -62,7 +60,7 @@ impl ProofAggregator {
6260 let wallet = EthereumWallet :: from ( signer) ;
6361
6462 // Check if the monthly budget is non-negative to avoid runtime errors later
65- let monthly_budget_in_wei = parse_ether ( config. monthly_budget_eth )
63+ let monthly_budget_in_wei = parse_ether ( & config. monthly_budget_eth . to_string ( ) )
6664 . expect ( "Monthly budget must be a non-negative value" ) ;
6765
6866 info ! ( "Monthly budget set to {} wei" , monthly_budget_in_wei) ;
@@ -160,7 +158,7 @@ impl ProofAggregator {
160158 // should be considered over a 24h period.
161159
162160 let gas_price = match self . rpc_provider . get_gas_price ( ) . await {
163- Ok ( price) => Ok ( price) ,
161+ Ok ( price) => Ok ( U256 :: from ( price) ) ,
164162 Err ( e1) => Err ( AggregatedProofSubmissionError :: GasPriceError (
165163 e1. to_string ( ) ,
166164 ) ) ,
@@ -169,7 +167,7 @@ impl ProofAggregator {
169167 if self . should_send_proof_to_verify_on_chain (
170168 time_elapsed,
171169 self . config . monthly_budget_eth ,
172- gas_price. into ( ) ,
170+ gas_price,
173171 ) {
174172 break ;
175173 } else {
@@ -198,12 +196,13 @@ impl ProofAggregator {
198196 const SECONDS_PER_MONTH : u64 = 30 * 24 * 60 * 60 ;
199197
200198 // Note: this expect is safe because in case it was invalid, should have been caught at startup
201- let monthly_budget_in_wei = parse_ether ( monthly_eth_budget)
199+ let monthly_budget_in_wei = parse_ether ( & monthly_eth_budget. to_string ( ) )
202200 . expect ( "The monthly budget should be a non-negative value" ) ;
203201
204202 let elapsed_seconds = U256 :: from ( time_elapsed. as_secs ( ) ) ;
205203
206- let budget_available_per_second_in_wei = monthly_budget_in_wei / SECONDS_PER_MONTH ;
204+ let budget_available_per_second_in_wei =
205+ monthly_budget_in_wei / U256 :: from ( SECONDS_PER_MONTH ) ;
207206
208207 budget_available_per_second_in_wei * elapsed_seconds
209208 }
0 commit comments