MinaProtocol / mina

Mina is a cryptocurrency protocol with a constant size blockchain, improving scaling while maintaining decentralization and security.
https://minaprotocol.com
Apache License 2.0
2k stars 528 forks source link

provide full runtime config to graphql #16356

Closed martyall closed 1 week ago

martyall commented 1 week ago

The Problem

@shimkiv discovered that the only values being returned by the graphql runtimeConfig query were the ones explicitly provided by the files, and did not incorporate the values coming from the profile defaults. This deviated from the previously defined behavior.

The Solution

This PR fixes this problem, and also centralizes the logic for overwriting defaults for {genesis, constraint}_constants. This logic was previously duplicated depending whether you were loading only the constants or also the ledger.

This PR also removes a duplicated field minimum_user_command_fee_string from mina_compile_config

How I tested

For example, now when running a local node on the dev profile and querying the endpoint:

➜  mina-lightweight-explorer git:(develop) ✗ curl -X POST http://localhost:3085/graphql \
  -H "Content-Type: application/json" \
  -d '{"query": "query { runtimeConfig }"}' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   831    0   795  100    36   468k  21726 --:--:-- --:--:-- --:--:--  811k
{
  "data": {
    "runtimeConfig": {
      "daemon": {
        "txpool_max_size": 3000,
        "zkapp_proof_update_cost": 10.26,
        "zkapp_signed_single_update_cost": 9.140000000000001,
        "zkapp_signed_pair_update_cost": 10.08,
        "zkapp_transaction_cost_limit": 69.45,
        "max_event_elements": 100,
        "max_action_elements": 100,
        "zkapp_cmd_limit_hardcap": 128,
        "minimum_user_command_fee": "2",
        "snark-worker-fee": 1
      },
      "genesis": {
        "k": 24,
        "delta": 0,
        "slots_per_epoch": 576,
        "slots_per_sub_window": 2,
        "grace_period_slots": 180,
        "genesis_state_timestamp": "2019-01-30T12:00:00.000000-08:00"
      },
      "proof": {
        "level": "check",
        "sub_windows_per_window": 3,
        "ledger_depth": 10,
        "work_delay": 2,
        "block_window_duration_ms": 2000,
        "transaction_capacity": {
          "2_to_the": 3
        },
        "coinbase_amount": "20",
        "supercharged_coinbase_factor": 1,
        "account_creation_fee": "0.001"
      },
      "ledger": {
        "name": "testnet_postake"
      }
    }
  }
}
martyall commented 1 week ago

!ci-nightly-me

martyall commented 1 week ago

Passing nightly tests: https://buildkite.com/o-1-labs-2/mina-end-to-end-nightlies/builds/2929

martyall commented 1 week ago

!ci-build-me

svv232 commented 1 week ago

https://buildkite.com/o-1-labs-2/mina-end-to-end-nightlies/builds/2929 nightly has passed for 7ccb7914ab6c5e5975b56a36e121d725058a700f