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

Switch default era to Babbage #4485

Merged
merged 1 commit into from
Sep 28, 2022

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented Sep 27, 2022

Code changes required for #4151

@newhoggy newhoggy marked this pull request as ready for review September 27, 2022 12:43
@newhoggy
Copy link
Contributor Author

newhoggy commented Sep 27, 2022

Verifying that transaction build works without era flag.

Commands:

CARDANO_NODE_SOCKET_PATH=example/main.sock \
$(./scripts/bin-path.sh cardano-cli) query utxo \
  --testnet-magic 42 \
  --address $( \
    cardano-cli address build \
      --testnet-magic 42 \
      --payment-verification-key-file \
      example/utxo-keys/utxo1.vkey
  ) \
  --out-file utxo.json

user1_utxo="$(cat utxo.json | jq -r 'to_entries[0].key')"
user1_addr="$(cat utxo.json | jq -r 'to_entries[0].value.address')"

CARDANO_NODE_SOCKET_PATH=example/main.sock \
$(./scripts/bin-path.sh cardano-cli) transaction build \
  --testnet-magic 42 \
  --change-address "${user1_addr}" \
  --tx-in "${user1_utxo}" \
  --tx-out "${user1_addr}+1000000" \
  --out-file tx.body

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli transaction sign --tx-body-file tx.body --signing-key-file example/utxo-keys/utxo1.skey --out-file tx.body.signed

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli transaction submit --tx-file tx.body.signed --testnet-magic 42

Output:

Estimated transaction fee: Lovelace 165721
Transaction successfully submitted.

@newhoggy
Copy link
Contributor Author

Verifying that transaction build works with --babbage-era flag.

Commands:

CARDANO_NODE_SOCKET_PATH=example/main.sock \
$(./scripts/bin-path.sh cardano-cli) query utxo \
  --testnet-magic 42 \
  --address $( \
    cardano-cli address build \
      --testnet-magic 42 \
      --payment-verification-key-file \
      example/utxo-keys/utxo1.vkey
  ) \
  --out-file utxo.json


user1_utxo="$(cat utxo.json | jq -r 'to_entries[0].key')"
user1_addr="$(cat utxo.json | jq -r 'to_entries[0].value.address')"

CARDANO_NODE_SOCKET_PATH=example/main.sock \
$(./scripts/bin-path.sh cardano-cli) transaction build \
  --babbage-era \
  --testnet-magic 42 \
  --change-address "${user1_addr}" \
  --tx-in "${user1_utxo}" \
  --tx-out "${user1_addr}+1000000" \
  --out-file tx.body

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli transaction sign --tx-body-file tx.body --signing-key-file example/utxo-keys/utxo1.skey --out-file tx.body.signed

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli transaction submit --tx-file tx.body.signed --testnet-magic 42

Output:

Estimated transaction fee: Lovelace 165721
Transaction successfully submitted.

@newhoggy
Copy link
Contributor Author

newhoggy commented Sep 27, 2022

Verifying that transaction build-raw works with --babbage-era flag.

mkdir -p example/work

CARDANO_NODE_SOCKET_PATH=example/main.sock \
$(./scripts/bin-path.sh cardano-cli) query utxo \
  --testnet-magic 42 \
  --address $( \
    cardano-cli address build \
      --testnet-magic 42 \
      --payment-verification-key-file \
      example/utxo-keys/utxo1.vkey
  ) \
  --out-file example/work/utxo.json


user1_utxo="$(cat example/work/utxo.json | jq -r 'to_entries[0].key')"
user1_addr="$(cat example/work/utxo.json | jq -r 'to_entries[0].value.address')"
user1_fund="$(cat example/work/utxo.json | jq -r 'to_entries[0].value.value.lovelace')"

fee=550152

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli query protocol-parameters --testnet-magic 42 > example/work/params.json

cardano-cli transaction build-raw \
  --babbage-era \
  --fee "$fee" \
  --out-file example/tx.body \
  --protocol-params-file example/work/params.json \
  --tx-in "$user1_utxo" \
  --tx-out "$user1_addr+$(($user1_fund - $fee))"

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli transaction sign --tx-body-file example/tx.body --signing-key-file example/utxo-keys/utxo1.skey --out-file example/tx.body.signed

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli transaction submit --tx-file example/tx.body.signed --testnet-magic 42

Result:

Transaction successfully submitted.

@newhoggy
Copy link
Contributor Author

Verifying that transaction build-raw works without era flag.

mkdir example/work

CARDANO_NODE_SOCKET_PATH=example/main.sock \
$(./scripts/bin-path.sh cardano-cli) query utxo \
  --testnet-magic 42 \
  --address $( \
    cardano-cli address build \
      --testnet-magic 42 \
      --payment-verification-key-file \
      example/utxo-keys/utxo1.vkey
  ) \
  --out-file example/work/utxo.json


user1_utxo="$(cat example/work/utxo.json | jq -r 'to_entries[0].key')"
user1_addr="$(cat example/work/utxo.json | jq -r 'to_entries[0].value.address')"
user1_fund="$(cat example/work/utxo.json | jq -r 'to_entries[0].value.value.lovelace')"

fee=550152

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli query protocol-parameters --testnet-magic 42 > example/work/params.json

cardano-cli transaction build-raw \
  --fee "$fee" \
  --out-file example/tx.body \
  --protocol-params-file example/work/params.json \
  --tx-in "$user1_utxo" \
  --tx-out "$user1_addr+$(($user1_fund - $fee))"

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli transaction sign --tx-body-file example/tx.body --signing-key-file example/utxo-keys/utxo1.skey --out-file example/tx.body.signed

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli transaction submit --tx-file example/tx.body.signed --testnet-magic 42

Result:

Transaction successfully submitted.

@newhoggy
Copy link
Contributor Author

Verifying that transaction calculate-min-required-utxo works without era flag.

mkdir -p example/work

CARDANO_NODE_SOCKET_PATH=example/main.sock \
$(./scripts/bin-path.sh cardano-cli) query utxo \
  --testnet-magic 42 \
  --address $( \
    cardano-cli address build \
      --testnet-magic 42 \
      --payment-verification-key-file \
      example/utxo-keys/utxo1.vkey
  ) \
  --out-file example/work/utxo.json


user1_utxo="$(cat example/work/utxo.json | jq -r 'to_entries[0].key')"
user1_addr="$(cat example/work/utxo.json | jq -r 'to_entries[0].value.address')"
user1_fund="$(cat example/work/utxo.json | jq -r 'to_entries[0].value.value.lovelace')"

cardano-cli transaction calculate-min-required-utxo --babbage-era --protocol-params-file example/work/params.json --tx-out "$user1_addr+0"

Result:

Lovelace 840450

@newhoggy
Copy link
Contributor Author

Verifying that transaction calculate-min-required-utxo works with --babbage-era flag.

mkdir -p example/work

CARDANO_NODE_SOCKET_PATH=example/main.sock \
$(./scripts/bin-path.sh cardano-cli) query utxo \
  --babbage-era \
  --testnet-magic 42 \
  --address $( \
    cardano-cli address build \
      --testnet-magic 42 \
      --payment-verification-key-file \
      example/utxo-keys/utxo1.vkey
  ) \
  --out-file example/work/utxo.json

user1_utxo="$(cat example/work/utxo.json | jq -r 'to_entries[0].key')"
user1_addr="$(cat example/work/utxo.json | jq -r 'to_entries[0].value.address')"
user1_fund="$(cat example/work/utxo.json | jq -r 'to_entries[0].value.value.lovelace')"

cardano-cli transaction calculate-min-required-utxo --babbage-era --protocol-params-file example/work/params.json --tx-out "$user1_addr+0"

Result:

Lovelace 840450

@newhoggy
Copy link
Contributor Author

All commands above were run against new instances of a testnet started with the following command:

rm -rf example; ./scripts/babbage/mkfiles.sh
example/run/all.sh

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

LGTM

@Jimbo4350
Copy link
Contributor

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 28, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit dbca757 into master Sep 28, 2022
@iohk-bors iohk-bors bot deleted the newhoggy/switch-default-era-to-babbage branch September 28, 2022 09:03
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.

None yet

3 participants