diff --git a/availability-oracle/src/contract.rs b/availability-oracle/src/contract.rs index 26ca33a..450516c 100644 --- a/availability-oracle/src/contract.rs +++ b/availability-oracle/src/contract.rs @@ -94,26 +94,15 @@ impl SubgraphAvailabilityManagerContract { #[async_trait] impl StateManager for RewardsManagerContract { async fn deny_many(&self, denied_status: Vec<([u8; 32], bool)>) -> Result<(), Error> { - // Based on this gas profile data for `setDeniedMany`: - // gas-used,items - // 4517721,200 - // 2271420,100 - // 474431,20 - // 47642,1 - // // 100 is considered as a good chunk size. for chunk in denied_status.chunks(100) { let ids: Vec<[u8; 32usize]> = chunk.iter().map(|s| s.0).collect(); let statuses: Vec = chunk.iter().map(|s| s.1).collect(); let num_subgraphs = ids.len() as u64; - let tx = self - .contract - .set_denied_many(ids, statuses) - // To avoid gas estimation errors, we use a high enough gas limit for 100 items - .gas(ethers::core::types::U256::from(3_000_000u64)); + let tx = self.contract.set_denied_many(ids, statuses); if let Err(err) = tx.call().await { - let message = err.decode_revert::().unwrap(); + let message = err.decode_revert::().unwrap_or(err.to_string()); error!(self.logger, "Transaction failed"; "message" => message, ); @@ -130,27 +119,16 @@ impl StateManager for RewardsManagerContract { #[async_trait] impl StateManager for SubgraphAvailabilityManagerContract { async fn deny_many(&self, denied_status: Vec<([u8; 32], bool)>) -> Result<(), Error> { - // Based on this gas profile data for `setDeniedMany`: - // gas-used,items - // 4517721,200 - // 2271420,100 - // 474431,20 - // 47642,1 - // // 100 is considered as a good chunk size. for chunk in denied_status.chunks(100) { let ids: Vec<[u8; 32usize]> = chunk.iter().map(|s| s.0).collect(); let statuses: Vec = chunk.iter().map(|s| s.1).collect(); let num_subgraphs = ids.len() as u64; let oracle_index = U256::from(self.oracle_index); - let tx = self - .contract - .vote_many(ids, statuses, oracle_index) - // To avoid gas estimation errors, we use a high enough gas limit for 100 items - .gas(U256::from(3_000_000u64)); + let tx = self.contract.vote_many(ids, statuses, oracle_index); if let Err(err) = tx.call().await { - let message = err.decode_revert::().unwrap(); + let message = err.decode_revert::().unwrap_or(err.to_string()); error!(self.logger, "Transaction failed"; "message" => message, );