Skip to content

Commit ad3ee4c

Browse files
authored
fix(entropy): Restore old signatures for methods returning structs (#2620)
* restore old signatures * revert method signature
1 parent a4333da commit ad3ee4c

File tree

7 files changed

+262
-71
lines changed

7 files changed

+262
-71
lines changed

apps/fortuna/src/command/get_request.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ pub async fn get_request(opts: &GetRequestOptions) -> Result<()> {
1414
&Config::load(&opts.config.config)?.get_chain_config(&opts.chain_id)?,
1515
)?);
1616

17+
let p = contract.get_provider_info(opts.provider).call().await?;
18+
19+
tracing::info!("Found provider: {:?}", p);
20+
1721
let r = contract
1822
.get_request(opts.provider, opts.sequence)
1923
.call()

apps/fortuna/src/command/inspect.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use {
22
crate::{
3-
chain::ethereum::{EntropyStructsV2Request, PythContract},
3+
chain::ethereum::{EntropyStructsRequest, PythContract},
44
config::{Config, EthereumConfig, InspectOptions},
55
},
66
anyhow::Result,
@@ -66,7 +66,7 @@ async fn inspect_chain(
6666
);
6767
current_request_number -= 1;
6868
}
69-
let return_data: Vec<EntropyStructsV2Request> = multicall.call_array().await?;
69+
let return_data: Vec<EntropyStructsRequest> = multicall.call_array().await?;
7070
for request in return_data {
7171
process_request(rpc_provider.clone(), request).await?;
7272
}
@@ -91,9 +91,9 @@ async fn inspect_chain(
9191

9292
async fn process_request(
9393
rpc_provider: Provider<Http>,
94-
request: EntropyStructsV2Request,
94+
request: EntropyStructsRequest,
9595
) -> Result<()> {
96-
if request.sequence_number != 0 && request.callback_status != 0 {
96+
if request.sequence_number != 0 && request.is_request_with_callback {
9797
let block = rpc_provider
9898
.get_block(request.block_number)
9999
.await?

apps/fortuna/src/command/setup_provider.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use {
22
crate::{
33
api::{get_register_uri, ChainId},
4-
chain::ethereum::{EntropyStructsV2ProviderInfo, SignablePythContract},
4+
chain::ethereum::{EntropyStructsProviderInfo, SignablePythContract},
55
command::register_provider::{register_provider_from_config, CommitmentMetadata},
66
config::{Config, EthereumConfig, SetupProviderOptions},
77
state::{HashChainState, PebbleHashChain},
@@ -178,7 +178,7 @@ async fn setup_chain_provider(
178178

179179
async fn sync_uri(
180180
contract: &Arc<SignablePythContract>,
181-
provider_info: &EntropyStructsV2ProviderInfo,
181+
provider_info: &EntropyStructsProviderInfo,
182182
uri: String,
183183
) -> Result<()> {
184184
let uri_as_bytes: Bytes = AbiBytes::from(uri.as_str()).into();
@@ -198,7 +198,7 @@ async fn sync_uri(
198198

199199
async fn sync_fee(
200200
contract: &Arc<SignablePythContract>,
201-
provider_info: &EntropyStructsV2ProviderInfo,
201+
provider_info: &EntropyStructsProviderInfo,
202202
provider_fee: u128,
203203
) -> Result<()> {
204204
if provider_info.fee_in_wei != provider_fee {
@@ -217,7 +217,7 @@ async fn sync_fee(
217217

218218
async fn sync_fee_manager(
219219
contract: &Arc<SignablePythContract>,
220-
provider_info: &EntropyStructsV2ProviderInfo,
220+
provider_info: &EntropyStructsProviderInfo,
221221
fee_manager: Address,
222222
) -> Result<()> {
223223
if provider_info.fee_manager != fee_manager {
@@ -231,7 +231,7 @@ async fn sync_fee_manager(
231231

232232
async fn sync_max_num_hashes(
233233
contract: &Arc<SignablePythContract>,
234-
provider_info: &EntropyStructsV2ProviderInfo,
234+
provider_info: &EntropyStructsProviderInfo,
235235
max_num_hashes: u32,
236236
) -> Result<()> {
237237
if provider_info.max_num_hashes != max_num_hashes {

target_chains/ethereum/contracts/contracts/entropy/Entropy.sol

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,14 @@ abstract contract Entropy is IEntropy, EntropyState {
628628

629629
function getProviderInfo(
630630
address provider
631+
) public view override returns (EntropyStructs.ProviderInfo memory info) {
632+
info = EntropyStructConverter.toV1ProviderInfo(
633+
_state.providers[provider]
634+
);
635+
}
636+
637+
function getProviderInfoV2(
638+
address provider
631639
) public view override returns (EntropyStructsV2.ProviderInfo memory info) {
632640
info = _state.providers[provider];
633641
}
@@ -644,6 +652,15 @@ abstract contract Entropy is IEntropy, EntropyState {
644652
function getRequest(
645653
address provider,
646654
uint64 sequenceNumber
655+
) public view override returns (EntropyStructs.Request memory req) {
656+
req = EntropyStructConverter.toV1Request(
657+
findRequest(provider, sequenceNumber)
658+
);
659+
}
660+
661+
function getRequestV2(
662+
address provider,
663+
uint64 sequenceNumber
647664
) public view override returns (EntropyStructsV2.Request memory req) {
648665
req = findRequest(provider, sequenceNumber);
649666
}

0 commit comments

Comments
 (0)