input-output-hk / mithril

Stake-based threshold multi-signatures protocol
https://mithril.network
Apache License 2.0
122 stars 37 forks source link

missing field `network` at line 1 column 18453. #1651

Closed perseus-algol closed 3 months ago

perseus-algol commented 4 months ago

Context & versions

Latest version at 820d9377e67c4e05ad3614f7b66b3e15249f5656 commit.

Steps to reproduce

It is possible to reproduce the problem either using explorer, or mithril-client-cli.

The problem appears only on: release-mainnet, release-preprod, pre-release-preview cardano networks. At testing-preview and testing-sanchonet everything works fine.

To reproduce problem using explorer

Actual result:

Expected result: Verification process started. In Popup window "Verify certificate" you should see certificates chain.

To reproduce using mithril-client-cli

Prepare mithril-client-cli/.env file with mainnet configuration:

# Cardano network
export NETWORK=mainnet

# Aggregator API endpoint URL
export AGGREGATOR_ENDPOINT=https://aggregator.release-mainnet.api.mithril.network/aggregator

# Genesis verification key
export GENESIS_VERIFICATION_KEY=$(wget -q -O - https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/release-mainnet/genesis.vkey)

# Digest of the latest produced snapshot for convenience of the demo
# You can also modify this variable and set it to the value of the digest of a snapshot that you can retrieve at step 2
export SNAPSHOT_DIGEST=latest

Then in terminal:

cd mithril-client-cli
source .env
cargo run -- cardano-db download 3aeb777c894d330e48e7136d3101b2576f6f956645957a9bd0bbb0ca00f62a48  # replace hash with existing one

Actial result:

Apr 23 16:33:46.455 CRIT Could not create certificate from API message: missing field `network` at line 1 column 18453.
Error: Can not verify the certificate chain from certificate_hash: '8383aebb521aae29b2100d0c776ea5567a66943534de4f310a4c884af33f0dce'

Caused by:
    missing field `network` at line 1 column 18453

@jpraynaud, you can assign it on me.

perseus-algol commented 4 months ago

So I see the cause of the problem. Aggregator's endpoint GET /certificate/{certificate_hash} returns network field in cert metadata at sanchonet, and mainnet aggregator doesn't.

In this commit network field was added to CertificateMetadataMessagePart on 28 Mar 2024. So I suspect that there is an older version of aggregator deployed with mainnet. And latest version deployed with sanchonet.

Is there a reason to have different versions of Mithril configured with different cardano networks? Since in explorer we can choose the cardano network, it assumed that explorer and aggregator should be in consistent state (same version).

jpraynaud commented 4 months ago

@perseus-algol thanks for creating the issue and investigating on it!

I think that this is related to a breaking change introduced which makes the unstable version of the client (the one which is deployed with the explorer) compatible only with the testing-preview and tetsing-sanchonet aggregators (not any more with the pre-release-preview, release-preprod or release-mainnet aggregators which are not running the latest version).

This is a temporary situation: the certificate verification will resume on all the networks when the next distribution is released :+1:

jpraynaud commented 3 months ago

The problem has been fixed with the release of the new 2418.1 distribution and the explorer is now able to verify the certificates from all the Mithril networks 👍