Skip to content

Conversation

@jayantk
Copy link
Contributor

@jayantk jayantk commented May 15, 2025

Summary

Update fortuna to set the default_gas_limit field on-chain, and then work with the new Entropy v2 interface. The main changes there are (1) replace the types of ProviderInfo and Request with their V2 variants, and (2) remove the gas_limit parameters from callback submission.

Rationale

we want to support the new version of the contract

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

I've tested this locally against the Entropy contract on blast-testnet (using the EntropyTester to simulate all of the various callback success / failure / out of gas conditions) and it works. I still want to test against a zk chain like Abstract, but that's pending the upgrade right now.

@vercel
Copy link

vercel bot commented May 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 9:27pm
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 9:27pm
developer-hub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 9:27pm
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 9:27pm
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 9:27pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 9:27pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 9:27pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 9:27pm


/// The gas limit to use for entropy callback transactions.
pub gas_limit: u64,
pub gas_limit: u32,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

u32 is the size of the field in the contract

Copy link
Contributor

@m30m m30m left a comment

Choose a reason for hiding this comment

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

I think in this new flow we should always make sure that the gas we set for the transaction is more than what the user requested. Now that the users set the gas limit, this is much easier and we can solve the cases where the gas used can vary a lot (from simulation time to landing time) based on other factors.

.call()
.await?;

// sequence_number == 0 means the request does not exist.
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this removed? I know that this check exists in some other places, but if we want to be safe and avoid unintended changes, we can keep it as is?

}

// If replica config is present, we're running with multiple instances.
// The incoming request is assigned by modulo operation on the sequence number
Copy link
Contributor

Choose a reason for hiding this comment

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

Earmarked this to fix when we do the work to expose the needed types to the API for the frontend to consume

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this value is in the requestV2 struct you retrieved ^ to check the status

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh perfect ty

sender,
gas_limit
)
sqlx::query("INSERT INTO request(chain_id, network_id, provider, sequence, created_at, last_updated_at, state, request_block_number, request_tx_hash, user_random_number, sender, gas_limit) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
Copy link
Contributor

Choose a reason for hiding this comment

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

Use query() instead of the query! macro since the compile-time checking of the queries doesn't reliably work with the local sqlite db, preventing building. Besides, since most of the queries are dynamically constructed, the compile time checking doesn't give us a guarantee they're correct anyway.

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.

3 participants