Skip to content

Commit f8bed14

Browse files
committed
chore: address code review comments
1 parent 33dfd5a commit f8bed14

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

custom-recipes/buildernet/mkosi/scripts/prepare.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ mkdir -p "${RUNTIME_DIR}"
3333

3434
if [[ "${SOURCE}" =~ ^https?:// ]]; then
3535
echo "prepare.sh: downloading from URL..."
36-
curl -fSL -o "${VM_IMAGE}" "${SOURCE}"
36+
TMP_IMAGE="${VM_IMAGE}.tmp"
37+
curl -fSL -o "${TMP_IMAGE}" "${SOURCE}"
38+
mv "${TMP_IMAGE}" "${VM_IMAGE}"
3739
elif [[ -f "${SOURCE}" ]]; then
3840
echo "prepare.sh: copying local file ($(du -h "${SOURCE}" | cut -f1))..."
3941
cp --sparse=always "${SOURCE}" "${VM_IMAGE}"
@@ -50,4 +52,4 @@ echo "prepare.sh: creating data disk..."
5052
qemu-img create -f raw "${VM_DATA_DISK}" 100G
5153

5254
echo "prepare.sh: runtime ready"
53-
ls -lah "${RUNTIME_DIR}"
55+
ls -lah "${RUNTIME_DIR}"

custom-recipes/buildernet/mkosi/scripts/start.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ if [[ "${ACCEL}" == "kvm" ]]; then
4141
echo " (TCG is ~10-20x slower but works anywhere)"
4242
exit 1
4343
fi
44-
QEMU_ACCEL_ARGS="-enable-kvm -cpu host"
44+
QEMU_ACCEL_ARGS=(-enable-kvm -cpu host)
4545
elif [[ "${ACCEL}" == "tcg" ]]; then
46-
QEMU_ACCEL_ARGS="-accel tcg -cpu max"
46+
QEMU_ACCEL_ARGS=(-accel tcg -cpu max)
4747
else
4848
echo "Error: Unknown QEMU_ACCEL value: ${ACCEL} (expected 'kvm' or 'tcg')"
4949
exit 1
@@ -63,7 +63,7 @@ echo " Console socket: ${CONSOLE_SOCK}"
6363
source "${SCRIPT_DIR}/ovmf.sh"
6464

6565
echo "start.sh: launching qemu-system-x86_64..."
66-
echo "start.sh: QEMU_ACCEL_ARGS=${QEMU_ACCEL_ARGS}"
66+
echo "start.sh: QEMU_ACCEL_ARGS=${QEMU_ACCEL_ARGS[*]}"
6767
echo "start.sh: VM_IMAGE=${VM_IMAGE} ($(du -h "${VM_IMAGE}" | cut -f1))"
6868
echo "start.sh: VM_DATA_DISK=${VM_DATA_DISK}"
6969

@@ -77,7 +77,7 @@ exec qemu-system-x86_64 \
7777
-drive if=pflash,format=raw,readonly=on,file="${OVMF_VARS}" \
7878
-drive format=qcow2,if=none,cache=none,id=osdisk,file="${VM_IMAGE}" \
7979
-device nvme,drive=osdisk,serial=nvme-os,bootindex=0 \
80-
${QEMU_ACCEL_ARGS} -m "${RAM}" -smp "${CPU}" -display none \
80+
"${QEMU_ACCEL_ARGS[@]}" -m "${RAM}" -smp "${CPU}" -display none \
8181
-device virtio-scsi-pci,id=scsi0 \
8282
-drive file="${VM_DATA_DISK}",format=raw,if=none,id=datadisk \
8383
-device nvme,id=nvme0,serial=nvme-data \

playground/test_tx.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,16 @@ func SendTestTransaction(ctx context.Context, cfg *TestTxConfig) error {
241241
// Get block to show extra data (builder name)
242242
block, err := elClient.BlockByNumber(ctx, receipt.BlockNumber)
243243
if err == nil && block != nil {
244-
extraData := string(block.Extra())
245-
fmt.Printf(" Extra Data: %s\n", extraData)
246-
247-
if cfg.ExpectedExtraData != "" && extraData != cfg.ExpectedExtraData {
248-
return fmt.Errorf("extra data mismatch: expected %q, got %q", cfg.ExpectedExtraData, extraData)
244+
extraHex := hex.EncodeToString(block.Extra())
245+
fmt.Printf(" Extra Data: 0x%s\n", extraHex)
246+
247+
if cfg.ExpectedExtraData != "" {
248+
expectedHex := hex.EncodeToString([]byte(cfg.ExpectedExtraData))
249+
if extraHex != expectedHex {
250+
fmt.Printf(" Extra Data check: failed\n")
251+
return fmt.Errorf("extra data mismatch: expected 0x%s (%q), got 0x%s", expectedHex, cfg.ExpectedExtraData, extraHex)
252+
}
253+
fmt.Printf(" Extra Data check: passed\n")
249254
}
250255
}
251256
return nil

0 commit comments

Comments
 (0)