Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blockfrost Implementation #1260

Merged
merged 272 commits into from
Feb 16, 2023
Merged

Blockfrost Implementation #1260

merged 272 commits into from
Feb 16, 2023

Conversation

errfrom
Copy link
Collaborator

@errfrom errfrom commented Nov 22, 2022

Closes #1119
Closes #734
Closes #1234

Includes #1364: Some tests for getTxMetadata, getScriptByHash, and getScriptsByHashes
Includes #1371: Framework for implementing Blockfrost queries
Includes #1385: Foundation for generating Blockfrost fixtures
Includes #1368: getTxMetadata and isTxConfirmed queries
Includes #1378: getDatumByHash and getScriptByHash queries
Includes #1366: utxosAt and getUtxoByOref queries
Includes #1372: getProtocolParameters and getCurrentEpoch queries
Includes #1376: submitTx and evaluateTx queries
Includes #1377: getChainTip, getEraSummaries, and getSystemStart queries
Includes #1389: Revised Contract testing utilities
Includes #1401: Various fixes, bring back submitE, trace log blockfrost requests
includes #1412: Introduce confirmTxDelay to smooth over issues with Blockfrost API

Notable changes:

  • ConfigParams r -> ContractParams (outside of QueryM)
  • Contract r -> Contract
  • Removed unused bindings for ODC and Ogmios. Namely utxo lookup in Ogmos, and Datum fetching in ODC. We no longer use them and are not exposed in the API.
    • ODC has been removed completely
    • Postgres too
      • This will only be for the CTL backend, it turns out blockfrost requires it
  • Fleshed out the docs a little to use the new types/contract params, and mention there's multiple backends.
  • getTxByHash is currently CTLBackend only. Will be removed when Kupo replaces ODC fully.
  • getTxByHash has been removed, and getTxMetadata has been added. This, as well as utxo, datum and script lookup, should cover all cases needed for getting a full transaction.
  • KeyWallet now receives a networkId on construction (for Contract based construction, this is asked)
    • It makes no sense to re-use a wallet for multiple networks, and this simplifies implementation
    • mkKeyWalletFromFiles/PrivateKeys is now in Contract and returns a KeyWallet instead of Wallet
    • Reverted the above, except for mkKeyWalletFromFiles still returns KeyWallet
  • reindexSpentScriptRedeemers is no longer in Contract (it's pure)
  • Lots of logic that was previously QueryM is now in Contract, polymorphic to the backend.
  • Removed submitE - submission is only in maybe internally. Readded
  • All 'cardano' actions are now implemented via the abstract handlers, other than those relating to staking
  • Test.Ctl.AffInterface -> Test.Ctl.QueryM.AffInterface
  • Moved ProtocolParameters, EraSummaries, Epoch, and SystemStartto Ctl.Internal.Types
  • Moved ClientError to Ctl.Internal.Service.Error

Remaining issues:

  • ContractEnv/QueryHandle mention Ogmios types.
    • Not a huge issue, but conceptually a bit odd.
    • ProtocolParameters (and EraSummaries) should ideally be placed in Cardano.Types. One issue is the Epoch type, which already exists in Cardano.Types.Transaction. The underlying representations are different however.
    • One problem with ProtocolParameters and EraSummaries, is the responses are different between Ogmios and Blockfrost, but I think only by camel case vs snake case. I don't think this is the case for tx evaluation though, which is explicitly implemented via ogmios by all backends.
  • Similar to other types, ClientError is defined by QueryM yet is used in Contract
  • In general I think backend-agnostic error responses/handling may need more thought
  • No metadata submission + fetching example
  • There's an issue with log supression in the Plutip tests

Pre-review checklist

  • All code has been formatted using our config (make format)
  • Any new API features or modification of existing behavior is covered as defined in our test plan
  • The changelog has been updated under the ## Unreleased header, using the appropriate sub-headings (### Added, ### Removed, ### Fixed), and the links to the appropriate issues/PRs have been included

@errfrom errfrom added the blockfrost CTL Blockfrost backend label Nov 22, 2022
@jy14898 jy14898 marked this pull request as ready for review December 7, 2022 13:59
@jy14898 jy14898 changed the title WIP: Make Contract query backend configurable Make Contract query backend configurable Dec 7, 2022
…t-runner-interface

Add Blockfrost test runner interface
- Made getPoolParameters explictly Ogmios-only
- Added ability to provide Blockfrost API key via localStorage in the
  browser
- Reorganized UtxoDistribution-related modules (finally untied
  everything from Plutip
- exit early if no funds left
- suggest skipping wallet funds redistribution if possible
Improve docs
@klntsky klntsky merged commit 76ead0a into develop Feb 16, 2023
@klntsky klntsky deleted the dshuiski/1119-query-backend branch February 16, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blockfrost CTL Blockfrost backend
Projects
None yet
9 participants