Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/fortuna/src/command/get_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ pub async fn get_request(opts: &GetRequestOptions) -> Result<()> {
&Config::load(&opts.config.config)?.get_chain_config(&opts.chain_id)?,
)?);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

drive-by. the docs say it gets the provider but it doesn't. It's useful also.

let p = contract.get_provider_info(opts.provider).call().await?;

tracing::info!("Found provider: {:?}", p);

let r = contract
.get_request(opts.provider, opts.sequence)
.call()
Expand Down
8 changes: 4 additions & 4 deletions apps/fortuna/src/command/inspect.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
crate::{
chain::ethereum::{EntropyStructsV2Request, PythContract},
chain::ethereum::{EntropyStructsRequest, PythContract},
config::{Config, EthereumConfig, InspectOptions},
},
anyhow::Result,
Expand Down Expand Up @@ -66,7 +66,7 @@ async fn inspect_chain(
);
current_request_number -= 1;
}
let return_data: Vec<EntropyStructsV2Request> = multicall.call_array().await?;
let return_data: Vec<EntropyStructsRequest> = multicall.call_array().await?;
for request in return_data {
process_request(rpc_provider.clone(), request).await?;
}
Expand All @@ -91,9 +91,9 @@ async fn inspect_chain(

async fn process_request(
rpc_provider: Provider<Http>,
request: EntropyStructsV2Request,
request: EntropyStructsRequest,
) -> Result<()> {
if request.sequence_number != 0 && request.callback_status != 0 {
if request.sequence_number != 0 && request.is_request_with_callback {
let block = rpc_provider
.get_block(request.block_number)
.await?
Expand Down
10 changes: 5 additions & 5 deletions apps/fortuna/src/command/setup_provider.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use {
crate::{
api::{get_register_uri, ChainId},
chain::ethereum::{EntropyStructsV2ProviderInfo, SignablePythContract},
chain::ethereum::{EntropyStructsProviderInfo, SignablePythContract},
command::register_provider::{register_provider_from_config, CommitmentMetadata},
config::{Config, EthereumConfig, SetupProviderOptions},
state::{HashChainState, PebbleHashChain},
Expand Down Expand Up @@ -178,7 +178,7 @@ async fn setup_chain_provider(

async fn sync_uri(
contract: &Arc<SignablePythContract>,
provider_info: &EntropyStructsV2ProviderInfo,
provider_info: &EntropyStructsProviderInfo,
uri: String,
) -> Result<()> {
let uri_as_bytes: Bytes = AbiBytes::from(uri.as_str()).into();
Expand All @@ -198,7 +198,7 @@ async fn sync_uri(

async fn sync_fee(
contract: &Arc<SignablePythContract>,
provider_info: &EntropyStructsV2ProviderInfo,
provider_info: &EntropyStructsProviderInfo,
provider_fee: u128,
) -> Result<()> {
if provider_info.fee_in_wei != provider_fee {
Expand All @@ -217,7 +217,7 @@ async fn sync_fee(

async fn sync_fee_manager(
contract: &Arc<SignablePythContract>,
provider_info: &EntropyStructsV2ProviderInfo,
provider_info: &EntropyStructsProviderInfo,
fee_manager: Address,
) -> Result<()> {
if provider_info.fee_manager != fee_manager {
Expand All @@ -231,7 +231,7 @@ async fn sync_fee_manager(

async fn sync_max_num_hashes(
contract: &Arc<SignablePythContract>,
provider_info: &EntropyStructsV2ProviderInfo,
provider_info: &EntropyStructsProviderInfo,
max_num_hashes: u32,
) -> Result<()> {
if provider_info.max_num_hashes != max_num_hashes {
Expand Down
17 changes: 17 additions & 0 deletions target_chains/ethereum/contracts/contracts/entropy/Entropy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,14 @@ abstract contract Entropy is IEntropy, EntropyState {

function getProviderInfo(
address provider
) public view override returns (EntropyStructs.ProviderInfo memory info) {
info = EntropyStructConverter.toV1ProviderInfo(
_state.providers[provider]
);
}

function getProviderInfoV2(
address provider
) public view override returns (EntropyStructsV2.ProviderInfo memory info) {
info = _state.providers[provider];
}
Expand All @@ -644,6 +652,15 @@ abstract contract Entropy is IEntropy, EntropyState {
function getRequest(
address provider,
uint64 sequenceNumber
) public view override returns (EntropyStructs.Request memory req) {
req = EntropyStructConverter.toV1Request(
findRequest(provider, sequenceNumber)
);
}

function getRequestV2(
address provider,
uint64 sequenceNumber
) public view override returns (EntropyStructsV2.Request memory req) {
req = findRequest(provider, sequenceNumber);
}
Expand Down
Loading
Loading