From 0df3dcd04be7ef248cf4f8788c33d16c4b08a8ac Mon Sep 17 00:00:00 2001 From: syntrust Date: Fri, 21 Aug 2026 17:08:49 +0800 Subject: [PATCH 1/4] qkc/testdata, qkc/config: add the pyquarkchain execution golden generator gen_exec_golden.py drives pyquarkchain's own EvmState and ShardState and exports what the Go execution layer has to reproduce, at three granularities: direct state mutations, one transaction or one cross-shard deposit, and a whole minor block on a shard built from its own genesis with a root chain alongside. A block-level case carries the shard's GENESIS.ALLOC, the serialized root blocks the shard saw, the deposit lists its neighbours sent, and each block in order. The generator reads the singularity configs this repo ships rather than a pyquarkchain checkout's, so the vectors are bound to our own artifacts. Its first two cases are the two networks' genesis allocations and it refuses to write anything unless they reproduce the roots already pinned in minor_genesis_golden.json -- without that calibration a mismatch cannot be told apart from a case description that never reached EvmState. The same trick works one level up: a block-level allocation is injected as the shard's own, so a consumer that applies it and nothing else must land on the genesis state root. That calibration says nothing about execution, though -- changing messages.py leaves the genesis root untouched. So every output file also records the oracle it came from: the pyquarkchain commit and a digest of each module that decides execution, with a refusal to run when one of those modules has uncommitted changes. Two things stood between the script and a clean pyquarkchain checkout, and both are handled from the outside so no oracle module is patched. cluster_config resolves the local hostname at import time, which raises on a machine whose hostname does not resolve, so gethostbyname is pinned to loopback before that import. And add_block publishes subscription notifications through asyncio.create_task, so main() runs inside asyncio.run. Co-Authored-By: Claude Opus 5 --- qkc/config/singularity/README.md | 44 + qkc/testdata/gen_exec_golden.py | 2863 ++++++++++++++++++++++++++++++ 2 files changed, 2907 insertions(+) create mode 100644 qkc/testdata/gen_exec_golden.py diff --git a/qkc/config/singularity/README.md b/qkc/config/singularity/README.md index 3d3e126489a..676f181e9ec 100644 --- a/qkc/config/singularity/README.md +++ b/qkc/config/singularity/README.md @@ -89,4 +89,48 @@ print('gas_limit ', block.header.evm_gas_limit, block.meta.evm_xshard_gas_limit " ``` +## Execution golden vectors + +The execution layer is pinned the same way, but by a script rather than a one-liner: +[`qkc/testdata/gen_exec_golden.py`](../../testdata/gen_exec_golden.py) drives +pyquarkchain's own `EvmState` and `ShardState` and writes +`qkc/testdata/exec_golden/*.json`. It reads the two configs in this directory, so +the vectors are bound to the configs goshard ships rather than to whatever a +pyquarkchain checkout happens to carry. + +Three granularities are emitted, each with its own file and its own consumer in +`qkc/core`: + +| file | input | pinned output | +| --- | --- | --- | +| `state_level.json` | direct `EvmState` mutations | post state root, per-account reads | +| `message_level.json` | one signed transaction or one cross-shard deposit | post state root, receipts, gas counters, produced deposits, coinbase fees | +| `block_level.json` | whole minor blocks against a shard built from its genesis, with a root chain alongside | the seven values a block commits to, plus the deposits it consumed | + +A block-level case carries the shard's genesis allocation, the serialized root +blocks it saw, the deposit lists its neighbours sent, and each block in order. +The allocation is the shard's `GENESIS.ALLOC`, so a consumer reaches the genesis +state root by applying it and nothing else — which is the same self-check the +genesis cases make, one level up. + +Regenerate with: + +``` +# from the root of a pyquarkchain checkout, inside a virtualenv with its +# requirements installed: +python /qkc/testdata/gen_exec_golden.py +``` + +The checkout is taken from `$PYQUARKCHAIN`, defaulting to the current directory. + +Two things guard the result. The script's first two cases are the genesis +allocations themselves, and it fails unless their state roots match the pinned +values above — a mismatch elsewhere is then a real disagreement, not a case +description that never reached `EvmState`. And because that self-check says +nothing about execution — changing `messages.py` leaves the genesis root +untouched — every vector file records the oracle it came from: the pyquarkchain +commit and a digest of each module that decides execution. The script refuses to +run when one of those modules has uncommitted changes; `--allow-dirty` proceeds +and names the edited modules in the output instead. + Consumed by `qkc`, `qkc/config`, `qkc/types`, and `cmd/slave` tests. diff --git a/qkc/testdata/gen_exec_golden.py b/qkc/testdata/gen_exec_golden.py new file mode 100644 index 00000000000..3558eaa5473 --- /dev/null +++ b/qkc/testdata/gen_exec_golden.py @@ -0,0 +1,2863 @@ +#!/usr/bin/env python3 +"""Generate execution golden vectors by driving pyquarkchain's own EvmState. + +The vectors pin what goshard's execution layer must reproduce byte for byte: +a pre-allocation, a sequence of inputs, and the resulting state root plus every +consensus-visible side effect. Three granularities are emitted: + + state direct EvmState mutations (balances, nonce, code, storage, deletion) + -> post state root. Covers the account and storage encoding rules. + message a signed transaction or a cross-shard deposit run through + apply_transaction / apply_xshard_deposit -> post state root, + receipts, gas counters, produced deposits, coinbase fees. + block whole minor blocks run through ShardState.run_block, on a shard + built from its genesis with a root chain alongside it -> the seven + values a block commits to, plus the deposits it consumed. + +The first state case of each network is the genesis allocation itself, and its +post root is asserted against qkc/testdata/minor_genesis_golden.json. Without +that self-check a mismatch cannot be told apart from a broken case description +(allocation never applied, shard config never set). + +Usage (from a pyquarkchain checkout, inside a virtualenv with its requirements +installed; see qkc/config/singularity/README.md): + + python /qkc/testdata/gen_exec_golden.py + +The pyquarkchain checkout is taken from $PYQUARKCHAIN, defaulting to the +current directory. +""" + +import asyncio +import hashlib +import json +import os +import subprocess +import sys + +_TESTDATA_DIR = os.path.dirname(os.path.abspath(__file__)) +_QKC_DIR = os.path.dirname(_TESTDATA_DIR) +_OUT_DIR = os.path.join(_TESTDATA_DIR, "exec_golden") + +_PYQUARKCHAIN = os.path.abspath(os.environ.get("PYQUARKCHAIN", os.getcwd())) +_ALLOW_DIRTY = "--allow-dirty" in sys.argv + +# The modules that decide what these vectors say. Their digests go into the +# output so a vector can be traced back to the exact source that produced it: +# the genesis self-check cannot do that job, since changing execution semantics +# leaves the genesis state root untouched. +_ORACLE_MODULES = ( + "quarkchain/evm/messages.py", + "quarkchain/evm/state.py", + "quarkchain/evm/transactions.py", + "quarkchain/evm/specials.py", + "quarkchain/evm/opcodes.py", + "quarkchain/cluster/shard_state.py", + "quarkchain/core.py", + "quarkchain/genesis.py", + "quarkchain/config.py", + "quarkchain/utils.py", +) + +sys.path.insert(0, _PYQUARKCHAIN) + +# cluster_config resolves the local hostname at import time to pick a default +# bind address (cluster_config.py:15). That lookup fails on a machine whose +# hostname has no A record, and the address it computes has no bearing on +# execution: nothing here starts a cluster. Pinning it to loopback keeps the +# import a pure code load, and leaves the oracle modules untouched. +import socket as _socket + +_socket.gethostbyname = lambda _host: "127.0.0.1" + +try: + from quarkchain.cluster.cluster_config import ClusterConfig + from quarkchain.cluster.shard_state import ShardState + from quarkchain.constants import GENERAL_NATIVE_TOKEN_CONTRACT_BYTECODE + from quarkchain.core import ( + Address, + Branch, + CrossShardTransactionDeposit, + CrossShardTransactionList, + MinorBlockHeader, + SerializedEvmTransaction, + TypedTransaction, + ) + from quarkchain.db import InMemoryDb + from quarkchain.env import Env + from quarkchain.evm.messages import apply_transaction, apply_xshard_deposit + from quarkchain.evm.state import State as EvmState + from quarkchain.evm.transactions import Transaction as EvmTransaction + from quarkchain.evm.utils import privtoaddr + from quarkchain.genesis import GenesisManager + from quarkchain.utils import token_id_encode +except ImportError as exc: # pragma: no cover - operator feedback only + sys.exit( + "cannot import quarkchain ({}); run from a pyquarkchain checkout or set " + "PYQUARKCHAIN to one, inside a virtualenv with its requirements".format(exc) + ) + + +# --------------------------------------------------------------------------- +# helpers + + +def oracle_provenance(): + """Identify the pyquarkchain the vectors were taken from. + + A golden vector is only as auditable as its oracle. Recording the commit, + refusing a dirty checkout and digesting the modules that decide execution + is what makes a regenerated file's differences attributable. + """ + def git(*args): + return subprocess.check_output( + ("git", "-C", _PYQUARKCHAIN) + args, text=True + ).strip() + + try: + commit = git("rev-parse", "HEAD") + # Only the modules above are checked for local edits. A dirty script or + # an untracked note has no bearing on what the vectors say, and failing + # on those would only teach the operator to pass --allow-dirty by habit. + status = git("status", "--porcelain", "--", *_ORACLE_MODULES) + except (subprocess.CalledProcessError, FileNotFoundError) as exc: + sys.exit("cannot read the pyquarkchain checkout at {}: {}".format(_PYQUARKCHAIN, exc)) + + # Porcelain lines are two status characters, a space, then the path. + dirty = sorted(line.split(maxsplit=1)[-1] for line in status.splitlines() if line.strip()) + if dirty and not _ALLOW_DIRTY: + sys.exit( + "these pyquarkchain modules decide what the vectors say and have " + "uncommitted changes:\n {}\ncommit or stash them so the vectors " + "name a reproducible oracle, or pass --allow-dirty to record the " + "edits in the output instead".format("\n ".join(dirty)) + ) + + digests = {} + for relative in _ORACLE_MODULES: + with open(os.path.join(_PYQUARKCHAIN, relative), "rb") as f: + digests[relative] = hashlib.sha256(f.read()).hexdigest()[:16] + return { + "pyquarkchain_commit": commit, + "dirty_modules": dirty, + "module_digests": digests, + } + + +def _hex(data): + return "0x" + data.hex() + + +def _addr(recipient_hex, full_shard_key): + """A 24-byte QuarkChain address from a 20-byte recipient.""" + return Address(bytes.fromhex(recipient_hex), full_shard_key) + + +def _recipient(recipient_hex): + return bytes.fromhex(recipient_hex) + + +# Recipients used by the hand-written cases. Values are arbitrary but fixed, so +# a regenerated file diffs cleanly against the previous one. +A = "aaaa0000000000000000000000000000000000aa" +B = "bbbb0000000000000000000000000000000000bb" +C = "cccc0000000000000000000000000000000000cc" + +# Deterministic signing keys; the vectors carry the resulting signature, so the +# Go side never has to reproduce pyquarkchain's signing. Message-level cases +# fund the key's own recipient, since the sender is recovered from the +# signature and not taken from the case description. +KEY_A = bytes.fromhex("1" * 64) +KEY_B = bytes.fromhex("2" * 64) +SENDER_A = privtoaddr(KEY_A).hex() +SENDER_B = privtoaddr(KEY_B).hex() + + +def load_networks(): + """The singularity configs goshard ships, loaded through pyquarkchain.""" + networks = {} + for name in ("mainnet", "devnet"): + path = os.path.join(_QKC_DIR, "config", "singularity", name + ".json") + with open(path) as f: + raw = json.load(f) + networks[name] = ClusterConfig.from_dict(raw) + return networks + + +def make_evm_state(cluster_config, full_shard_id, **overrides): + """EvmState set up the way ShardState.__create_evm_state does. + + Env.cluster_config is assigned rather than passed to the constructor: its + setter is what configures the precompiled contracts' enable timestamps from + the hard fork config (env.py:45-53). + """ + env = Env(db=InMemoryDb()) + env.cluster_config = cluster_config + qkc_config = env.quark_chain_config + state = EvmState(env=env.evm_env, db=env.db, qkc_config=qkc_config) + state.shard_config = qkc_config.shards[full_shard_id] + state.sender_disallow_map = {} + for key, value in overrides.items(): + setattr(state, key, value) + return state + + +def apply_alloc(state, alloc): + """Apply a pre-allocation exactly as GenesisManager.create_minor_block does. + + Sharing this path with the genesis case is what makes the genesis + self-check meaningful (quarkchain/genesis.py:55-86). + """ + for address_hex, entry in alloc.items(): + address = Address.create_from(bytes.fromhex(address_hex)) + state.full_shard_key = address.full_shard_key + recipient = address.recipient + code = entry.get("code") + if code is not None: + state.set_code(recipient, bytes.fromhex(code[2:])) + state.set_nonce(recipient, 1) + for slot, value in entry.get("storage", {}).items(): + state.set_storage_data(recipient, int(slot, 16), int(value, 16)) + for token, value in entry.get("balances", {}).items(): + state.delta_token_balance(recipient, token_id_encode(token), int(value)) + + +def config_alloc(cluster_config, full_shard_id): + """A shard's genesis ALLOC in the vectors' own allocation shape.""" + genesis = cluster_config.QUARKCHAIN.shards[full_shard_id].GENESIS + alloc = {} + for address_hex, entry in genesis.ALLOC.items(): + balances = entry.get("balances", entry) + out = { + "balances": { + k: str(v) for k, v in balances.items() if k not in ("code", "storage") + } + } + if "code" in entry: + out["code"] = entry["code"] + if "storage" in entry: + out["storage"] = entry["storage"] + alloc[address_hex] = out + return alloc + + +# --------------------------------------------------------------------------- +# state-level vectors + + +def run_state_ops(state, ops): + """Interpret one case's op list against a live EvmState.""" + snapshots = [] + for op in ops: + kind = op["op"] + if kind == "set_full_shard_key": + state.full_shard_key = op["value"] + elif kind == "delta_token_balance": + state.delta_token_balance( + _recipient(op["address"]), token_id_encode(op["token"]), int(op["value"]) + ) + elif kind == "set_token_balance": + state.set_token_balance( + _recipient(op["address"]), token_id_encode(op["token"]), int(op["value"]) + ) + elif kind == "read_account": + # A plain read, which caches a blank account stamped with the shard + # key current right now (state.py:387). The cache outlives the + # transaction, so this is where the key freezes. + state.get_balance(_recipient(op["address"])) + elif kind == "set_nonce": + state.set_nonce(_recipient(op["address"]), op["value"]) + elif kind == "increment_nonce": + state.increment_nonce(_recipient(op["address"])) + elif kind == "set_code": + state.set_code(_recipient(op["address"]), bytes.fromhex(op["code"][2:])) + elif kind == "set_storage": + state.set_storage_data( + _recipient(op["address"]), int(op["key"], 16), int(op["value"], 16) + ) + elif kind == "reset_balances": + state.reset_balances(_recipient(op["address"])) + elif kind == "reset_storage": + state.reset_storage(_recipient(op["address"])) + elif kind == "del_account": + state.del_account(_recipient(op["address"])) + elif kind == "snapshot": + snapshots.append(state.snapshot()) + elif kind == "revert": + state.revert(snapshots.pop()) + elif kind == "commit": + state.commit() + else: + raise ValueError("unknown state op {}".format(kind)) + + +def observe(state, recipients, slots): + """Post-commit reads, so a mismatched root can be localized to an account.""" + out = {} + for recipient_hex in sorted(recipients): + recipient = _recipient(recipient_hex) + account = state.get_and_cache_account(recipient, should_cache=False) + entry = { + "nonce": account.nonce, + "code_hash": _hex(account.code_hash), + "full_shard_key": account.full_shard_key, + "exists": not account.is_blank(), + "balances": { + str(token): str(value) + for token, value in sorted(account.token_balances.to_dict().items()) + }, + } + case_slots = slots.get(recipient_hex) + if case_slots: + entry["storage"] = { + slot: "0x{:x}".format(account.get_storage_data(int(slot, 16))) + for slot in sorted(case_slots) + } + out[recipient_hex] = entry + return out + + +def build_state_case(networks, case): + cluster_config = networks[case["network"]] + full_shard_id = case.get("full_shard_id", 1) + state = make_evm_state(cluster_config, full_shard_id) + alloc = case["pre_alloc"] + + # The allocation is committed before the operations run, so they start from + # a state that has been through the trie -- accounts read back from leaves, + # nothing left touched from having been created. Executing against a still + # dirty cache is a shape that only occurs while genesis is being built, and + # it changes the answers: an account nothing touches is skipped by commit + # entirely, so a case run against uncommitted allocations can pin a result + # that no block would ever produce. + apply_alloc(state, alloc) + state.commit() + pre_state_root = _hex(state.trie.root_hash) + + run_state_ops(state, case["ops"]) + state.commit() + + recipients = {a[:40] for a in alloc} + slots = {a[:40]: set(alloc[a].get("storage", {})) for a in alloc} + for op in case["ops"]: + if "address" in op: + recipients.add(op["address"]) + if op["op"] == "set_storage": + slots.setdefault(op["address"], set()).add(op["key"]) + + return { + "name": case["name"], + "comment": case["comment"], + "network": case["network"], + "full_shard_id": full_shard_id, + "pre_alloc": alloc, + # The root the allocation commits to, before any operation runs. A + # consumer that reaches a different one has a problem in its allocation + # handling, not in the operations under test. + "pre_state_root": pre_state_root, + "ops": case["ops"], + "post_state_root": _hex(state.trie.root_hash), + "accounts": observe(state, recipients, slots), + } + + +def state_cases(networks): + """Hand-written state cases, genesis self-check first.""" + cases = [] + for network in ("mainnet", "devnet"): + cases.append( + { + "name": "genesis_alloc_" + network, + "comment": "self-check: the shipped genesis ALLOC must reproduce the " + "pinned minor genesis state root", + "network": network, + "pre_alloc": config_alloc(networks[network], 1), + "ops": [], + } + ) + + qkc_only = {"balances": {"QKC": "1000000000000000000"}} + cases += [ + { + "name": "touched_blank_account_pruned", + "comment": "a zero-value delta only marks the account touched; commit " + "deletes it rather than writing a blank leaf (state.py:562-586)", + "network": "devnet", + "pre_alloc": {}, + "ops": [ + {"op": "delta_token_balance", "address": A, "token": "QKC", "value": "0"} + ], + }, + { + "name": "drained_account_pruned", + "comment": "an account whose only balance goes back to zero is blank " + "again and leaves the trie", + "network": "devnet", + "pre_alloc": {A + "00000001": qkc_only}, + "ops": [ + { + "op": "delta_token_balance", + "address": A, + "token": "QKC", + "value": "-1000000000000000000", + } + ], + }, + { + "name": "nonce_keeps_account", + "comment": "nonce alone defeats is_blank, so a balance-less account " + "stays in the trie", + "network": "devnet", + "pre_alloc": {}, + "ops": [ + {"op": "set_full_shard_key", "value": 1}, + {"op": "increment_nonce", "address": A}, + ], + }, + { + "name": "full_shard_key_freezes_at_first_read", + "comment": "the shard key stamped into a new account is the one " + "current when the address was first looked up, not when it was " + "first written: get_and_cache_account builds the blank account " + "with state.full_shard_key and caches it (state.py:387), and the " + "cache lives until commit. A is read under key 1 and written under " + "key 2, so its leaf carries 1; B is only ever written, so it " + "carries 2 and shows what the other would have looked like", + "network": "devnet", + "pre_alloc": {}, + "ops": [ + {"op": "set_full_shard_key", "value": 1}, + {"op": "read_account", "address": A}, + {"op": "set_full_shard_key", "value": 2}, + {"op": "delta_token_balance", "address": A, "token": "QKC", "value": "5"}, + {"op": "delta_token_balance", "address": B, "token": "QKC", "value": "5"}, + ], + }, + { + "name": "storage_alone_prunes_account", + "comment": "storage does not defeat is_blank: the account is dropped " + "and its storage trie becomes unreachable", + "network": "devnet", + "pre_alloc": {}, + "ops": [ + {"op": "set_full_shard_key", "value": 1}, + {"op": "set_storage", "address": A, "key": "0x01", "value": "0x2a"}, + ], + }, + { + "name": "storage_zero_deletes_slot", + "comment": "writing zero deletes the slot instead of storing it " + "(state.py:236-241)", + "network": "devnet", + "pre_alloc": { + A + + "00000001": { + "balances": {"QKC": "5"}, + "code": "0x6000", + "storage": {"0x01": "0x2a", "0x02": "0x2b"}, + } + }, + "ops": [{"op": "set_storage", "address": A, "key": "0x01", "value": "0x0"}], + }, + { + "name": "token_blob_sorted_and_zero_free", + "comment": "the balance blob is ordered by token id and carries no " + "zero entries, whatever order they were written in", + "network": "devnet", + "pre_alloc": {}, + "ops": [ + {"op": "set_full_shard_key", "value": 1}, + {"op": "delta_token_balance", "address": A, "token": "ZZZ", "value": "3"}, + {"op": "delta_token_balance", "address": A, "token": "QKC", "value": "1"}, + {"op": "delta_token_balance", "address": A, "token": "BTC", "value": "2"}, + {"op": "delta_token_balance", "address": A, "token": "AAA", "value": "7"}, + {"op": "delta_token_balance", "address": A, "token": "AAA", "value": "-7"}, + ], + }, + { + "name": "del_account_removes_leaf", + "comment": "del_account clears balances, nonce, code and storage and " + "unsets touched, so commit deletes the leaf (state.py:596-610)", + "network": "devnet", + "pre_alloc": { + A + + "00000001": { + "balances": {"QKC": "9"}, + "code": "0x6001", + "storage": {"0x01": "0x2a"}, + } + }, + "ops": [{"op": "del_account", "address": A}], + }, + { + "name": "revert_undoes_mutations", + "comment": "snapshot/revert restores balances, nonce, code and storage; " + "the post root equals the untouched allocation's", + "network": "devnet", + "pre_alloc": {A + "00000001": qkc_only}, + "ops": [ + {"op": "snapshot"}, + {"op": "delta_token_balance", "address": A, "token": "QKC", "value": "7"}, + {"op": "delta_token_balance", "address": B, "token": "QKC", "value": "5"}, + {"op": "increment_nonce", "address": A}, + {"op": "set_code", "address": A, "code": "0x6002"}, + {"op": "set_storage", "address": A, "key": "0x01", "value": "0x2a"}, + {"op": "revert"}, + ], + }, + { + "name": "zeroed_token_entry_is_not_absent", + "comment": "a balance set to zero leaves the entry in the map, so the " + "blob is an empty pair list rather than empty bytes; only an account " + "that never held the token serializes to nothing (state.py:144-150)", + "network": "devnet", + "pre_alloc": { + A + "00000001": {"balances": {"QKC": "5"}, "code": "0x6000"}, + B + "00000001": {"code": "0x6000"}, + }, + "ops": [ + {"op": "set_token_balance", "address": A, "token": "QKC", "value": "0"} + ], + }, + { + "name": "revert_does_not_restore_reset_balances", + "comment": "reset_balances journals the restore onto a misspelled " + "attribute (state.py:192-198), so reverting brings back the token trie " + "but not the balances; the account stays drained. The opening credit " + "is what makes that observable: reset_balances marks nothing touched, " + "so without it commit would skip the account and both a faithful and " + "a naively correct implementation would agree", + "network": "devnet", + "pre_alloc": {A + "00000001": {"balances": {"QKC": "5"}, "code": "0x6000"}}, + "ops": [ + {"op": "delta_token_balance", "address": A, "token": "QKC", "value": "1"}, + {"op": "snapshot"}, + {"op": "reset_balances", "address": A}, + {"op": "revert"}, + ], + }, + { + "name": "revert_after_del_account", + "comment": "reverting del_account leaves the trie untouched: unwinding " + "its six steps ends at the touched flag set_nonce journaled, which was " + "False, so commit skips the account rather than rewriting the leaf it " + "would otherwise have drained (a selfdestruct in a reverted frame)", + "network": "devnet", + "pre_alloc": { + A + + "00000001": { + "balances": {"QKC": "5"}, + "code": "0x6000", + "storage": {"0x01": "0x2a"}, + } + }, + "ops": [ + {"op": "snapshot"}, + {"op": "del_account", "address": A}, + {"op": "revert"}, + ], + }, + { + "name": "revert_of_balance_leaves_zero_entry", + "comment": "TokenBalances.set_balance journals the undo as " + "_balances[token_id] = preval (state.py:166), which writes the key " + "back rather than deleting it. Reverting the only credit an account " + "ever received therefore leaves it holding zero rather than holding " + "nothing, and the leaf is 00c0 instead of empty bytes. The nonce is " + "bumped before the snapshot so the account is non-blank and touched " + "for a reason the revert does not unwind", + "network": "devnet", + "pre_alloc": {B + "00000001": {"balances": {"QKC": "5"}}}, + "ops": [ + {"op": "increment_nonce", "address": A}, + {"op": "snapshot"}, + {"op": "delta_token_balance", "address": A, "token": "QKC", "value": "5"}, + {"op": "revert"}, + ], + }, + { + "name": "zero_entry_lost_on_read_back", + "comment": "the zero entry lives only in the in-memory map: " + "TokenBalances.__init__ rebuilds _balances from the pair list " + "(state.py:104), which carries no zeros, so an account whose leaf is " + "00c0 comes back holding nothing and re-serializes to empty bytes. " + "Touching it after the commit boundary without writing a balance is " + "what makes the leaf change on its own", + "network": "devnet", + "pre_alloc": {A + "00000001": {"balances": {"QKC": "5"}}}, + "ops": [ + {"op": "increment_nonce", "address": A}, + {"op": "set_token_balance", "address": A, "token": "QKC", "value": "0"}, + {"op": "commit"}, + {"op": "increment_nonce", "address": A}, + ], + }, + { + "name": "committed_storage_reopens", + "comment": "a contract's storage survives a commit boundary: the " + "second commit reads the slots back through the trie", + "network": "devnet", + "pre_alloc": { + A + "00000001": {"balances": {"QKC": "5"}, "code": "0x6000"} + }, + "ops": [ + {"op": "set_storage", "address": A, "key": "0x01", "value": "0x2a"}, + {"op": "commit"}, + {"op": "set_storage", "address": A, "key": "0x02", "value": "0x2b"}, + ], + }, + ] + return cases + + +# --------------------------------------------------------------------------- +# message-level vectors + + +def build_tx(spec, qkc_config): + # A version 2 transaction is signed under Ethereum's rules, where the + # network id in the signature is the chain's eth chain id rather than + # QuarkChain's network id (test_utils.py:122). + network_id = qkc_config.NETWORK_ID + if spec.get("version", 0) == 2: + network_id = qkc_config.CHAINS[spec.get("from_full_shard_key", 1) >> 16].ETH_CHAIN_ID + tx = EvmTransaction( + nonce=spec.get("nonce", 0), + gasprice=spec.get("gas_price", 0), + startgas=spec.get("start_gas", 21000), + to=bytes.fromhex(spec.get("to", "")), + value=int(spec.get("value", 0)), + data=bytes.fromhex(spec.get("data", "0x")[2:]), + gas_token_id=token_id_encode(spec.get("gas_token", "QKC")), + transfer_token_id=token_id_encode(spec.get("transfer_token", "QKC")), + from_full_shard_key=spec.get("from_full_shard_key", 1), + to_full_shard_key=spec.get("to_full_shard_key", 1), + network_id=network_id, + version=spec.get("version", 0), + ) + # The shard size behind the full shard keys is what decides whether the + # transaction is cross-shard, and with it the intrinsic gas. + tx.set_quark_chain_config(qkc_config) + key = {"A": KEY_A, "B": KEY_B}[spec.get("signer", "A")] + # network_id is already set above; passing it to sign() would write it back + # outside the serializable's mutable context and raise. + tx.sign(key) + return tx + + +def dump_tx(tx): + return { + "nonce": tx.nonce, + "gas_price": str(tx.gasprice), + "start_gas": tx.startgas, + "to": _hex(tx.to), + "value": str(tx.value), + "data": _hex(tx.data), + "network_id": tx.network_id, + "from_full_shard_key": tx.from_full_shard_key, + "to_full_shard_key": tx.to_full_shard_key, + "gas_token_id": tx.gas_token_id, + "transfer_token_id": tx.transfer_token_id, + "version": tx.version, + "v": str(tx.v), + "r": str(tx.r), + "s": str(tx.s), + "sender": _hex(tx.sender), + "hash": _hex(tx.hash), + } + + +def build_deposit(spec): + return CrossShardTransactionDeposit( + tx_hash=bytes.fromhex(spec["tx_hash"][2:]), + from_address=_addr(spec["from"], spec.get("from_full_shard_key", 1)), + to_address=_addr(spec["to"], spec.get("to_full_shard_key", 1)), + value=int(spec.get("value", 0)), + gas_price=int(spec.get("gas_price", 0)), + gas_token_id=token_id_encode(spec.get("gas_token", "QKC")), + transfer_token_id=token_id_encode(spec.get("transfer_token", "QKC")), + gas_remained=int(spec.get("gas_remained", 0)), + message_data=bytes.fromhex(spec.get("message_data", "0x")[2:]), + create_contract=spec.get("create_contract", False), + is_from_root_chain=spec.get("is_from_root_chain", False), + refund_rate=spec.get("refund_rate", 100), + ) + + +def dump_deposit(deposit): + return { + "tx_hash": _hex(deposit.tx_hash), + "from": _hex(deposit.from_address.recipient), + "from_full_shard_key": deposit.from_address.full_shard_key, + "to": _hex(deposit.to_address.recipient), + "to_full_shard_key": deposit.to_address.full_shard_key, + "value": str(deposit.value), + "gas_price": str(deposit.gas_price), + "gas_token_id": deposit.gas_token_id, + "transfer_token_id": deposit.transfer_token_id, + "gas_remained": str(deposit.gas_remained), + "message_data": _hex(deposit.message_data), + "create_contract": deposit.create_contract, + "is_from_root_chain": deposit.is_from_root_chain, + "refund_rate": deposit.refund_rate, + } + + +def dump_receipt(receipt): + return { + "success": receipt.state_root == b"\x01", + "cumulative_gas_used": receipt.gas_used, + "bloom": "0x{:0512x}".format(receipt.bloom), + "contract_address": _hex(receipt.contract_address), + "contract_full_shard_key": receipt.contract_full_shard_key, + "logs": [ + { + "address": _hex(log.address), + "topics": ["0x{:064x}".format(t) for t in log.topics], + "data": _hex(log.data), + } + for log in receipt.logs + ], + } + + +def build_message_case(networks, case): + cluster_config = networks[case["network"]] + qkc_config = cluster_config.QUARKCHAIN + full_shard_id = case.get("full_shard_id", 1) + coinbase = _recipient(case.get("block_coinbase", C)) + state = make_evm_state( + cluster_config, + full_shard_id, + timestamp=case["timestamp"], + gas_limit=case.get("gas_limit", 12000000), + block_number=case.get("block_number", 1), + block_coinbase=coinbase, + block_difficulty=case.get("block_difficulty", 1), + ) + apply_alloc(state, case["pre_alloc"]) + state.commit() + + recipients = {a[:40] for a in case["pre_alloc"]} + recipients.add(case.get("block_coinbase", C)) + + # Building and dumping the input stays outside the guarded call below: only + # the execution may raise on purpose. A case must also say which outcome it + # is pinning, so that a broken constructor, a drifted API or a crash in the + # success path cannot quietly become a "this is rejected" vector that the Go + # side then asserts forever. + expect = case["expect"] + if expect not in ("success", "rejected"): + raise SystemExit("case {}: expect must be success or rejected".format(case["name"])) + + inputs = [] + if "tx" in case: + tx = build_tx(case["tx"], qkc_config) + inputs.append({"kind": "transaction", "transaction": dump_tx(tx)}) + recipients.add(tx.sender.hex()) + if tx.to: + recipients.add(tx.to.hex()) + + def execute(): + return apply_transaction(state, tx, tx.hash) + else: + deposit = build_deposit(case["deposit"]) + inputs.append({"kind": "deposit", "deposit": dump_deposit(deposit)}) + recipients.add(deposit.from_address.recipient.hex()) + recipients.add(deposit.to_address.recipient.hex()) + + def execute(): + return apply_xshard_deposit(state, deposit, case.get("gas_used_start", 0)) + + if expect == "success": + success, output = execute() + result = {"success": bool(success), "output": _hex(bytes(output))} + else: + try: + execute() + except Exception as exc: # noqa: BLE001 - the rejection is the vector + # Consumers assert that execution is refused, not the wording: the + # message is pyquarkchain's and carries no consensus meaning. + result = { + "rejected": True, + "error_type": type(exc).__name__, + "error": str(exc), + } + else: + raise SystemExit( + "case {}: expected a rejection, execution succeeded".format(case["name"]) + ) + + state.commit() + return { + "name": case["name"], + "comment": case["comment"], + "network": case["network"], + "full_shard_id": full_shard_id, + "expect": expect, + "context": { + "timestamp": case["timestamp"], + "gas_limit": state.gas_limit, + "block_number": state.block_number, + "block_coinbase": _hex(coinbase), + "block_difficulty": state.block_difficulty, + }, + "pre_alloc": case["pre_alloc"], + "inputs": inputs, + # A deposit's starting gas is decided by the cursor traversal, above + # apply_xshard_deposit. It has to be dumped or the consumer cannot + # reproduce the run: it is an input, not a result. + "gas_used_start": case.get("gas_used_start", 0), + "result": result, + "post_state_root": _hex(state.trie.root_hash), + "gas_used": state.gas_used, + "xshard_receive_gas_used": state.xshard_receive_gas_used, + "block_fee_tokens": { + str(token): str(value) for token, value in sorted(state.block_fee_tokens.items()) + }, + "receipts": [dump_receipt(r) for r in state.receipts], + "xshard_deposit_receipts": [dump_receipt(r) for r in state.xshard_deposit_receipts], + "xshard_list": [dump_deposit(d) for d in state.xshard_list], + "accounts": observe(state, recipients, {}), + } + + +# The general native token manager's address (specials.py:446). Whatever code +# sits here is what prices a foreign gas token. +GENERAL_NATIVE_TOKEN_ADDRESS = "514b430000000000000000000000000000000003" + +# Stand-ins for the manager, used where a case is about the *chain's* handling +# of the answer rather than about the manager's own arithmetic. The real +# contract's admin interface is not exercised by pyquarkchain's own tests +# either: they monkey-patch pay_native_token_as_gas. Running fixed bytecode at +# the manager's address instead keeps both sides on the same EVM, so the vector +# still pins every consensus step around the answer: the quote taken and +# unwound during validation, the reserve check, the two balance moves that swap +# native token for genesis token, the refund at the returned rate and the burn +# of the remainder. +# +# Each returns the manager's two words: the refund rate, then the gas price in +# genesis token. mstore(0, rate); mstore(32, price); return(0, 64). +MANAGER_RATE_80_PRICE_2 = "0x6050600052600260205260406000f3" +MANAGER_RATE_100_PRICE_0 = "0x6064600052600060205260406000f3" + +QKC_TRANSFER_MNT_ADDRESS = "000000000000000000000000000000514b430002" +QKC_DEPLOY_SYSTEM_CONTRACT_ADDRESS = "000000000000000000000000000000514b430003" + +# The auction contract's address (specials.py:443). It is the only sender the +# mint precompile accepts, so a case about minting has to run code from here. +NON_RESERVED_NATIVE_TOKEN_ADDRESS = "514b430000000000000000000000000000000002" + +# The two native-token precompiles (specials.py:394), reachable from the +# native-token fork onwards. +MINT_MNT_ADDRESS = "000000000000000000000000000000514b430004" +BALANCE_MNT_ADDRESS = "000000000000000000000000000000514b430005" + +# Hand-written bytecode, kept minimal so a vector's inputs can be read without +# a compiler. Each is exactly what the case needs and nothing else. +# +# ANSWER_RUNTIME mstore(0, 42); return(0, 32) +# ANSWER_INIT returns ANSWER_RUNTIME as the deployed code +# REVERT_RUNTIME revert(0, 0) +# INFINITE_RUNTIME jumpdest; jump(0) -- runs until the gas is gone +# LOG_RUNTIME log1(0, 32, 0xbeef…) over zeroed memory +# CREATE2_RUNTIME create2 of an init code that deploys empty code +ANSWER_RUNTIME = "0x602a60005260206000f3" +ANSWER_INIT = "0x69602a60005260206000f3600052600a6016f3" +REVERT_RUNTIME = "0x60006000fd" +INFINITE_RUNTIME = "0x5b600056" +LOG_RUNTIME = "0x7fbeef" + "00" * 29 + "60206000a100" +CREATE2_RUNTIME = "0x6460006000f36000526000600560" + "1b" + "6000f500" + +# CREATE2_WORD_GAS_RUNTIME expands memory to exactly 3072 bytes and then runs +# CREATE2 over all of it, as the last instruction in the code. +# +# mstore(0x0be0, 0) expand to ceil32(0x0be0 + 32) = 3072 bytes = 96 words +# create2(0, 0, 0x0c00, 0) 96 words of init code, no further expansion +# +# It is built to sit on the boundary the word charge creates. Up to and +# including CREATE2's 32000 the frame spends 32327; the 6-per-word charge on +# top is 576 more. pyquarkchain subtracts that charge without checking +# (vm.py:689) and mem_extend only checks when it has to grow, so a frame given +# less than 32903 goes negative there rather than running out. Placing CREATE2 +# last is what makes the difference observable: the main loop's `gas < 0` test +# is at the top of the next iteration, which never comes. +CREATE2_WORD_GAS_RUNTIME = "0x6000610be0526000610c0060006000f5" + +# The same CREATE2 without the mstore in front, so the memory still has to grow. +# mem_extend then does check what it is about to spend, which makes an +# underfunded frame a plain out-of-gas on both sides -- the case that says a +# consumer must not mistake every short CREATE2 for the boundary above. +CREATE2_GROW_RUNTIME = "0x6000610c0060006000f5" + + +def general_native_token_runtime(): + """The manager's deployed code, taken out of its deployment bytecode. + + Allocating the runtime directly is how pyquarkchain's own tests stand the + contract up (test_shard_state.py:3350): the shipped bytecode is a + constructor whose supervisor argument is fixed, so a case that has to drive + the admin interface cannot use it as-is. + """ + runtime_start = GENERAL_NATIVE_TOKEN_CONTRACT_BYTECODE.find( + bytes.fromhex("608060405260"), 1 + ) + return _hex(GENERAL_NATIVE_TOKEN_CONTRACT_BYTECODE[runtime_start:-32]) + + +def word(value): + return "{:064x}".format(value) + + +def selfdestruct_runtime(beneficiary_hex): + """selfdestruct(beneficiary).""" + return "0x73" + beneficiary_hex + "ff" + + +def _push(value, width=None): + """PUSHn of the smallest width that holds value, or a fixed one.""" + if isinstance(value, str): + raw = value + else: + raw = "{:x}".format(value) + raw = "0" * (len(raw) % 2) + raw + raw = raw or "00" + if width is not None: + raw = raw.rjust(width * 2, "0") + size = len(raw) // 2 + if size == 0: + raw, size = "00", 1 + return "{:02x}".format(0x5F + size) + raw + + +def _mstore(offset, value): + return _push(value) + _push(offset) + "52" + + +def _call(to_hex, gas, args_offset, args_size, ret_offset, ret_size, value=0): + """CALL, whose arguments are pushed in the reverse of their order.""" + return ( + _push(ret_size) + + _push(ret_offset) + + _push(args_size) + + _push(args_offset) + + _push(value) + + _push(to_hex) + + _push(gas) + + "f1" + ) + + +def transfer_mnt_runtime(to_hex, token_id, value, forwarded_gas, tail=""): + """call the transfer-token precompile with (to, token id, value), then tail. + + The precompile is handed a fixed amount of gas rather than everything left, + so what it gives back on a refusal is visible in what the caller can still + afford to do afterwards. The answer lands at memory 0x80. + """ + return ( + "0x" + + _mstore(0, to_hex) + + _mstore(0x20, token_id) + + _mstore(0x40, value) + + _call(QKC_TRANSFER_MNT_ADDRESS, forwarded_gas, 0, 0x60, 0x80, 0x20) + + _push(0) + + "55" # sstore(0, call result) + + tail + ) + + +def deploy_system_contract_runtime(index): + """call the deploy precompile, then return whatever it answered.""" + return ( + "0x" + + _mstore(0, index) + + _call(QKC_DEPLOY_SYSTEM_CONTRACT_ADDRESS, 1500000, 0, 0x20, 0x20, 0x20) + + "50" # drop the call result + + _push(0x20) + + _push(0x20) + + "f3" # return(0x20, 32) + ) + + +def return_memory_word(offset): + """return the 32-byte word at offset.""" + return _push(0x20) + _push(offset) + "f3" + + +# create(0, 0, 0) then return the address it produced. +# create(0, 0, 0), then return the address it produced. +CREATE_AND_RETURN_RUNTIME = "0x" + _push(0) * 3 + "f0" + _push(0) + "52" + return_memory_word(0) + + +def call_runtime(callee_hex): + """call(gas, callee, 0, 0, 0, 0, 0); stop.""" + return "0x" + "6000" * 5 + "73" + callee_hex + "5af100" + + +def mint_mnt_runtime(minter_hex, token_id, amount_word, args_size, forwarded_gas): + """call the mint precompile with args_size bytes of the three-word argument. + + args_size below 96 is the point: extract32 reads past the calldata as zeros + (vm.py:59), so a short call is not refused — it mints whatever the truncated + amount word comes to. + """ + return ( + "0x" + + _mstore(0, minter_hex) + + _mstore(0x20, token_id) + + _mstore(0x40, amount_word) + + _call(MINT_MNT_ADDRESS, forwarded_gas, 0, args_size, 0x80, 0x20) + + _push(0) + + "55" # sstore(0, call result) + ) + + +def create_runtime(init_hex): + """create(0, init code) and store the address it answered with in slot 0.""" + init = init_hex[2:] if init_hex.startswith("0x") else init_hex + size = len(init) // 2 + return ( + "0x" + + _push(init) + + _push(0) + + "52" # mstore(0, init code), which lands it right-aligned + + _push(size) + + _push(32 - size) + + _push(0) + + "f0" # create(value=0, offset=32-size, size) + + _push(0) + + "55" # sstore(0, address) + ) + + +def returndatacopy_runtime(callee_hex, size): + """call a contract that returns 32 bytes, then copy size bytes of the answer.""" + return ( + "0x" + + _call(callee_hex, 100000, 0, 0, 0, 0) + + "50" # drop the call result + + _push(size) + + _push(0) + + _push(0) + + "3e" # returndatacopy(0, 0, size) + + _push(0) + + _push(0) + + "51" # mload(0) ... + + "55" # ... sstore(0, that word) + ) + + +# Six SSTOREs covering every transition the legacy schedule prices differently, +# including two slots written twice in the one transaction. Under EIP-1283's +# net metering — which Constantinople had and Petersburg took back out — the +# repeats cost 200 instead of 5000, so the gas this case records is what says +# which schedule is running. +SSTORE_TIERS_RUNTIME = ( + "0x" + + _push(0) + _push(0) + "55" # 0 -> 0, on a clean slot + + _push(7) + _push(2) + "55" # 0 -> non-zero + + _push(3) + _push(1) + "55" # non-zero -> non-zero + + _push(0) + _push(1) + "55" # non-zero -> 0, same slot again: refund + + _push(1) + _push(3) + "55" # 0 -> non-zero + + _push(2) + _push(3) + "55" # non-zero -> non-zero, same slot again +) + +# Init code that returns `size` zero bytes, so the deployment's code-store +# charge is chosen by the case. +def returning_init(size): + return "0x" + _push(size) + _push(0) + "f3" + + +def message_cases(): + """A first, deliberately small set: S3-S6 grow it per semantics entry.""" + funded = {"balances": {"QKC": "1000000000000000000"}} + # devnet has every hard fork switch at 0, so these run post-EVM throughout. + return [ + { + "name": "in_shard_transfer", + "expect": "success", + "comment": "plain in-shard QKC transfer: nonce increments before gas is " + "bought, fee lands in the coinbase and in block_fee_tokens", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 0, + "gas_price": 1000000000, + "start_gas": 30000, + "to": SENDER_B, + "value": 100, + "signer": "A", + }, + }, + { + "name": "in_shard_transfer_nonce_too_high", + "expect": "rejected", + "comment": "apply_transaction re-validates, so a future nonce is " + "rejected and nothing is written", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 5, + "gas_price": 1000000000, + "start_gas": 30000, + "to": SENDER_B, + "value": 100, + "signer": "A", + }, + }, + { + "name": "in_shard_transfer_insufficient_balance", + "expect": "rejected", + "comment": "the balance check covers value plus the whole gas budget", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": {"balances": {"QKC": "21000"}}}, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 30000, + "to": SENDER_B, + "value": 100, + "signer": "A", + }, + }, + { + "name": "xshard_deposit_to_empty_account", + "expect": "success", + "comment": "post-EVM deposit: the value is credited to the sender on " + "this shard first, then moved by an EVM message (messages.py:368-377)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {}, + "gas_used_start": 9000, + "deposit": { + "tx_hash": "0x" + "11" * 32, + "from": A, + "to": B, + "value": 1000, + "gas_price": 1000000000, + "gas_remained": 0, + }, + }, + { + "name": "native_token_transfer_with_default_gas", + "expect": "success", + "comment": "a foreign transfer token with the chain's own token for " + "gas: no conversion, the fee stays in QKC and only the transfer " + "moves QETH", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": { + "balances": {"QKC": "1000000000000000000", "QETH": "99999"} + } + }, + "tx": { + "nonce": 0, + "gas_price": 1000000000, + "start_gas": 30000, + "to": SENDER_B, + "value": 12345, + "signer": "A", + "transfer_token": "QETH", + }, + }, + { + "name": "native_token_transfer_sender_holds_none", + "expect": "rejected", + "comment": "validate_transaction (4): a token the sender holds none " + "of is refused outright, where the chain's own token is spendable " + "from empty", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 0, + "gas_price": 1000000000, + "start_gas": 30000, + "to": SENDER_B, + "value": 12345, + "signer": "A", + "transfer_token": "QETH", + }, + }, + { + "name": "native_token_as_gas_converted", + "expect": "success", + "comment": "gas paid in QETH: the manager is asked for a price, sells " + "the genesis token that funds the frame and keeps the QETH, and the " + "unused gas comes back at the rate it named — 80%, with the other " + "20% burned to the zero address (messages.py:438-460, 268)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": {"balances": {"QETH": "10000000"}}, + GENERAL_NATIVE_TOKEN_ADDRESS + "00000001": { + "balances": {"QKC": "1000000000000000000"}, + "code": MANAGER_RATE_80_PRICE_2, + }, + }, + "tx": { + "nonce": 0, + "gas_price": 3, + "start_gas": 30000, + "to": SENDER_B, + "value": 12345, + "signer": "A", + "gas_token": "QETH", + "transfer_token": "QETH", + }, + }, + { + "name": "native_token_as_gas_priced_at_zero", + "expect": "rejected", + "comment": "the manager answering zero is a refusal, not free gas " + "(messages.py:243)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": {"balances": {"QETH": "10000000"}}, + GENERAL_NATIVE_TOKEN_ADDRESS + "00000001": { + "balances": {"QKC": "1000000000000000000"}, + "code": MANAGER_RATE_100_PRICE_0, + }, + }, + "tx": { + "nonce": 0, + "gas_price": 3, + "start_gas": 30000, + "to": SENDER_B, + "value": 12345, + "signer": "A", + "gas_token": "QETH", + "transfer_token": "QETH", + }, + }, + { + "name": "native_token_as_gas_reserve_too_small", + "expect": "rejected", + "comment": "the manager has a price but not enough genesis token to " + "settle the whole allowance at it (messages.py:253)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": {"balances": {"QETH": "10000000"}}, + GENERAL_NATIVE_TOKEN_ADDRESS + "00000001": { + "balances": {"QKC": "1000"}, + "code": MANAGER_RATE_80_PRICE_2, + }, + }, + "tx": { + "nonce": 0, + "gas_price": 3, + "start_gas": 30000, + "to": SENDER_B, + "value": 12345, + "signer": "A", + "gas_token": "QETH", + "transfer_token": "QETH", + }, + }, + { + "name": "mnt_balance_precompile", + "expect": "success", + "comment": "the balance precompile reads any token for any address " + "at a flat 400 gas (specials.py:365)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": { + "balances": {"QKC": "1000000000000000000", "QETH": "777"} + } + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 100000, + "to": BALANCE_MNT_ADDRESS, + "value": 0, + "signer": "A", + # (address, token id) — the sender's own QETH balance. + "data": "0x000000000000000000000000" + + SENDER_A + + "00000000000000000000000000000000000000000000000000000000001388f9", + }, + }, + { + "name": "mnt_mint_precompile_rejects_foreign_sender", + "expect": "success", + "comment": "minting is the auction contract's alone: called by anyone " + "else the frame fails and its whole allowance is gone " + "(specials.py:356)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 100000, + "to": MINT_MNT_ADDRESS, + "value": 0, + "signer": "A", + # (minter, token id, amount) + "data": "0x000000000000000000000000" + + SENDER_A + + "00000000000000000000000000000000000000000000000000000000001388f9" + + "00000000000000000000000000000000000000000000000000000000000003e8", + }, + }, + { + "name": "transfer_mnt_refusal_keeps_the_rest_of_the_gas", + "expect": "success", + "comment": "the transfer-token precompile refusing for want of " + "balance costs only the call surcharge and hands the rest back " + "(specials.py:264): the caller can still afford the store that " + "follows, which it could not if the refusal had burned the frame", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + # The contract holds no QETH at all, so the transfer is refused + # after the surcharge is charged. + A + "00000001": { + "balances": {}, + "code": transfer_mnt_runtime(B, 1280249, 10 ** 18, 60000, tail=_push(42) + _push(1) + "55" + "00"), + }, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 300000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "deploy_system_contract_returns_its_address", + "expect": "success", + "comment": "the deploy precompile answers with the address it " + "deployed to, not with the code it deployed (messages.py:783), and " + "a contract can read that off the return data", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": { + "balances": {}, + "code": deploy_system_contract_runtime(1), + }, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 2000000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "create_under_a_shard_key", + "expect": "success", + "comment": "a CREATE in an ordinary frame derives its address from " + "rlp([sender, full_shard_key, nonce]) (messages.py:704). Paired " + "with the case below, which reaches the same code without a key", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + B + "00000001": {"balances": {}, "code": CREATE_AND_RETURN_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 300000, + "to": B, + "value": 0, + "signer": "A", + }, + }, + { + "name": "create_under_transfer_mnt_has_no_shard_key", + "expect": "success", + "comment": "the transfer-token precompile builds its child message " + "without a shard key (specials.py:265), so the same code deploys to " + "Ethereum's rlp([sender, nonce]) address instead — a different " + "account and a different state root", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": { + "balances": {}, + "code": transfer_mnt_runtime(B, 35760, 0, 200000, + tail=return_memory_word(0x80)), + }, + B + "00000001": {"balances": {}, "code": CREATE_AND_RETURN_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 500000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "contract_creation", + "expect": "success", + "comment": "a deployment: the address is " + "keccak(rlp([sender, full_shard_key, nonce]))[12:], the top-level " + "nonce does not move for the CREATE itself, and the receipt carries " + "the address and its shard key (messages.py:704)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": "", + "value": 0, + "signer": "A", + "data": ANSWER_INIT, + }, + }, + { + "name": "contract_call_returns_value", + "expect": "success", + "comment": "calling deployed code: the return data reaches the " + "caller and the gas actually burned is what the receipt records", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": ANSWER_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "contract_revert", + "expect": "success", + "comment": "a reverting call is a failed transaction, not a rejected " + "one: the state goes back, the gas is gone and the receipt says so", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": REVERT_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 1000, + "signer": "A", + }, + }, + { + "name": "contract_out_of_gas", + "expect": "success", + "comment": "running out of gas costs the whole allowance and leaves " + "the value where it started", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": INFINITE_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 50000, + "to": A, + "value": 1000, + "signer": "A", + }, + }, + { + "name": "contract_selfdestruct", + "expect": "success", + "comment": "the suicide list is applied after the message, not at the " + "opcode (messages.py:351): the balance moves to the beneficiary and " + "del_account strips the account, which the end-of-block sweep then " + "drops", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": { + "balances": {"QKC": "5000"}, + "code": selfdestruct_runtime(B), + }, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "contract_logs_and_bloom", + "expect": "success", + "comment": "one log with one topic: the receipt's bloom and the " + "block's are built from it", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": LOG_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "contract_create2", + "expect": "success", + "comment": "CREATE2 from inside a frame: unlike a top-level CREATE, a " + "nested one moves the creator's nonce", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": CREATE2_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "create2_word_gas_underflows", + "expect": "rejected", + "comment": "CREATE2's per-word charge is subtracted unchecked and the " + "memory it is charged for needs no growing, so the frame carries a " + "negative gas counter past the point anything would notice it; with " + "CREATE2 last, the frame hands that counter back and apply_transaction " + "trips its own `assert gas_remained >= 0` (messages.py:305). The " + "transaction is not refused for a reason -- pyquarkchain cannot " + "process it at all, so no block containing it exists", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": CREATE2_WORD_GAS_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + # 21000 intrinsic + 32500 for the frame: past CREATE2's 32000 but + # 403 short of the word charge. + "start_gas": 53500, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "create2_word_gas_covered", + "expect": "success", + "comment": "the same code with the word charge paid for, which is what " + "makes the case above readable: same frame, 500 more gas, and the " + "deployment goes through normally", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": CREATE2_WORD_GAS_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + # 21000 intrinsic + 33000 for the frame: 97 left after the charge. + "start_gas": 54000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "create2_word_gas_oog_while_growing", + "expect": "success", + "comment": "the same shortfall with the memory still to grow: " + "mem_extend checks before it spends, so both sides simply run out of " + "gas and the transaction is processed with a failed receipt. This is " + "the case that keeps the boundary above from swallowing an ordinary " + "out-of-gas and abandoning a block that is fine", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": CREATE2_GROW_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + # 21000 intrinsic + 32500 for the frame, against 32894 needed. + "start_gas": 53500, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "nested_call", + "expect": "success", + "comment": "a call inside a call: the inner frame's gas comes out of " + "the outer one's and both are settled once, at the top", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": call_runtime(B)}, + B + "00000001": {"balances": {}, "code": ANSWER_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "eip155_transfer", + "expect": "success", + "comment": "a version 2 (EIP155) transaction, which devnet enables at " + "genesis: the sender is recovered under Ethereum's rules and the " + "shard keys must both be zero (messages.py:139-183)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 30000, + "to": SENDER_B, + "value": 100, + "signer": "A", + "version": 2, + "from_full_shard_key": 0, + "to_full_shard_key": 0, + }, + }, + { + "name": "eip155_before_enable_timestamp", + "expect": "rejected", + "comment": "mainnet only enables the EIP155 signer in 2021; before " + "that the version is refused whatever else it says", + "network": "mainnet", + "timestamp": 1569567600, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 30000, + "to": SENDER_B, + "value": 100, + "signer": "A", + "version": 2, + "from_full_shard_key": 0, + "to_full_shard_key": 0, + }, + }, + { + "name": "eip155_non_default_token", + "expect": "rejected", + "comment": "the EIP155 signer has no field for a token, so both must " + "be the chain's own", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": { + "balances": {"QKC": "1000000000000000000", "QETH": "99999"} + } + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 30000, + "to": SENDER_B, + "value": 100, + "signer": "A", + "version": 2, + "from_full_shard_key": 0, + "to_full_shard_key": 0, + "transfer_token": "QETH", + }, + }, + { + "name": "eip155_non_zero_shard_key", + "expect": "rejected", + "comment": "a non-zero shard key is how a version 2 transaction would " + "become cross-shard, which the signer does not support", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 30000, + "to": SENDER_B, + "value": 100, + "signer": "A", + "version": 2, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + }, + }, + { + "name": "xshard_source_transfer", + "expect": "success", + "comment": "the source half of a cross-shard transfer: the value " + "leaves, a deposit carries the whole remaining allowance to the " + "target, and the surcharge is left out of both the fee and gas_used " + "(messages.py:520-560)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 0, + "gas_price": 2, + "start_gas": 60000, + "to": SENDER_B, + "value": 1000, + "signer": "A", + "from_full_shard_key": 1, + "to_full_shard_key": 0x10001, + }, + }, + { + "name": "xshard_source_contract_creation", + "expect": "success", + "comment": "a cross-shard deployment: the address is derived here, " + "from the sender's nonce as it now stands, and the code is deployed " + "on the target (messages.py:494)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {SENDER_A + "00000001": funded}, + "tx": { + "nonce": 0, + "gas_price": 2, + "start_gas": 200000, + "to": "", + "value": 500, + "signer": "A", + "data": ANSWER_INIT, + "from_full_shard_key": 1, + "to_full_shard_key": 0x10001, + }, + }, + { + "name": "xshard_deposit_failed_message_leaves_funds_with_sender", + "expect": "success", + "comment": "the deposit credits the sender on this shard first and " + "only then moves the value by a message; when that message fails the " + "money stays with the sender here rather than going back " + "(messages.py:368-377)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": {A + "00000001": {"balances": {}, "code": REVERT_RUNTIME}}, + "gas_used_start": 9000, + "deposit": { + "tx_hash": "0x" + "22" * 32, + "from": B, + "to": A, + "value": 1000, + "gas_price": 1, + "gas_remained": 100000, + }, + }, + { + "name": "mnt_balance_precompile_pads_short_calldata", + "expect": "success", + "comment": "the balance precompile reads its arguments with " + "extract32 (vm.py:59), so calldata that stops after the address is " + "not refused: the token id reads as zero and the call succeeds at " + "the same flat 400 gas", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": { + "balances": {"QKC": "1000000000000000000", "QETH": "777"} + } + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 100000, + "to": BALANCE_MNT_ADDRESS, + "value": 0, + "signer": "A", + # Only the address word; the token id is off the end. + "data": "0x000000000000000000000000" + SENDER_A, + }, + }, + { + "name": "mnt_mint_precompile_pads_short_calldata", + "expect": "success", + "comment": "the mint precompile reads its amount with extract32 as " + "well: 80 bytes of calldata leaves the amount word half off the end, " + "and what is minted is that half padded with zeros, not a refusal", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + SENDER_B + "00000001": {"balances": {"QKC": "1000"}}, + NON_RESERVED_NATIVE_TOKEN_ADDRESS + + "00000001": { + "balances": {}, + # Only the auction contract may mint, so the call has to + # come from its address (specials.py:357). + "code": mint_mnt_runtime( + SENDER_B, 0x1388F9, 1 << 128, 0x50, 100000 + ), + }, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": NON_RESERVED_NATIVE_TOKEN_ADDRESS, + "value": 0, + "signer": "A", + }, + }, + { + "name": "sstore_legacy_pricing", + "expect": "success", + "comment": "SSTORE is metered the pre-EIP-1283 way — 20000 for a " + "clean zero to non-zero, 5000 otherwise, and a flat 15000 refund for " + "clearing — including for a slot the same transaction writes twice", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + + "00000001": { + "balances": {}, + "code": SSTORE_TIERS_RUNTIME, + "storage": {"0x1": "0x1"}, + }, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "returndatacopy_within_the_answer", + "expect": "success", + "comment": "copying exactly as many bytes as the last call returned " + "is in range (vm.py:542)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": returndatacopy_runtime(B, 32)}, + B + "00000001": {"balances": {}, "code": ANSWER_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "returndatacopy_past_the_answer", + "expect": "success", + "comment": "one byte past what the last call returned is an " + "exception, and an exception costs the frame everything it had left", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": returndatacopy_runtime(B, 33)}, + B + "00000001": {"balances": {}, "code": ANSWER_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "create_init_code_reverts", + "expect": "success", + "comment": "init code that reverts leaves no contract and pushes " + "zero, and the creating frame keeps what the init code did not spend " + "(messages.py:793)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": create_runtime(REVERT_RUNTIME)}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "create_code_store_out_of_gas", + "expect": "success", + "comment": "paying for the deployed code is all or nothing: too " + "little gas for the 200-per-byte charge reverts the deployment and " + "takes the rest of the gas with it (messages.py:781)", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + + "00000001": { + "balances": {}, + "code": create_runtime(returning_init(100)), + }, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 60000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "create_code_too_large", + "expect": "success", + "comment": "one byte over the 24576 limit fails the same way, " + "whatever gas is left", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + + "00000001": { + "balances": {}, + "code": create_runtime(returning_init(24577)), + }, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + "start_gas": 8000000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + ] + + +# --------------------------------------------------------------------------- +# block-level vectors + + +def make_shard_state(network_name, case): + """A ShardState on its genesis, with the case's allocation as the shard's. + + The configuration is reloaded per case: the allocation is injected into the + shard's GENESIS, so a shared config object would leak one case's accounts + into the next. Proof-of-work and difficulty validation are switched off + through the flags pyquarkchain itself exposes for that (DISABLE_POW_CHECK, + SKIP_MINOR_DIFFICULTY_CHECK). Neither is read by run_block: they gate + validate_block, which these vectors do not describe. + """ + cluster_config = load_networks()[network_name] + qkc_config = cluster_config.QUARKCHAIN + qkc_config.DISABLE_POW_CHECK = True + qkc_config.SKIP_MINOR_DIFFICULTY_CHECK = True + + full_shard_id = case["full_shard_id"] + shard_config = qkc_config.shards[full_shard_id] + # The case writes balances as decimal strings, the same as everywhere else + # in these vectors; GenesisManager adds them to the account as they are. + shard_config.GENESIS.ALLOC = { + address: dict( + entry, + balances={token: int(value) for token, value in entry["balances"].items()}, + ) + for address, entry in case["genesis_alloc"].items() + } + + env = Env(db=InMemoryDb()) + env.cluster_config = cluster_config + state = ShardState(env=env, full_shard_id=full_shard_id) + genesis_root_block = GenesisManager(qkc_config).create_root_block() + state.init_genesis_state(genesis_root_block) + return state, genesis_root_block + + +def remote_header(state, spec, prev_root_hash): + """A minor block header from another shard, as the root chain carries it. + + Only the fields the cursor traversal reads are meaningful: the branch + decides whether this shard is a neighbour of the sender, and + hash_prev_root_block decides whether the sender's shard was allowed to send + at that point (shard_state.py:172-186). The rest exists so the header + hashes, and that hash is what the deposit list is keyed by. + """ + return MinorBlockHeader( + version=0, + height=spec.get("height", 1), + branch=Branch(spec["full_shard_id"]), + coinbase_address=Address.create_empty_account(spec["full_shard_id"]), + hash_prev_root_block=prev_root_hash, + create_time=spec.get("create_time", 1), + difficulty=spec.get("difficulty", 1), + extra_data=spec.get("extra_data", "").encode(), + ) + + +def add_root_block(state, spec, dumped_root_blocks, dumped_xshard_lists): + """Append one root block to the shard's view of the root chain. + + Remote deposit lists have to reach the shard before the root block that + confirms them: add_root_block checks for each neighbour header that the + list is already there (shard_state.py:1467). + """ + root_block = state.root_tip.create_block_to_append() + prev_root_hash = state.root_tip.get_hash() + + for header_spec in spec.get("minor_headers", []): + if header_spec.get("local_tip"): + root_block.add_minor_block_header(state.header_tip) + continue + header = remote_header(state, header_spec, prev_root_hash) + deposits = [build_deposit(d) for d in header_spec.get("deposits", [])] + state.add_cross_shard_tx_list_by_minor_block_hash( + h=header.get_hash(), tx_list=CrossShardTransactionList(tx_list=deposits) + ) + dumped_xshard_lists.append( + { + "minor_block_hash": _hex(header.get_hash()), + "full_shard_id": header_spec["full_shard_id"], + "deposits": [dump_deposit(d) for d in deposits], + } + ) + root_block.add_minor_block_header(header) + + coinbase = spec.get("coinbase") + if coinbase is None: + root_block.finalize() + else: + root_block.finalize( + coinbase_tokens={ + token_id_encode(token): int(value) + for token, value in coinbase.get("tokens", {}).items() + }, + coinbase_address=_addr(coinbase["address"], coinbase["full_shard_key"]), + ) + + state.add_root_block(root_block) + dumped_root_blocks.append( + { + "height": root_block.header.height, + "hash": _hex(root_block.header.get_hash()), + "block": _hex(root_block.serialize()), + } + ) + return root_block + + +def build_minor_block(state, spec, qkc_config): + """Assemble the block finalize_and_add_block would, without running it yet. + + create_block_to_mine is deliberately not used: it stamps wall-clock tracking + data into the block, picks up whatever the transaction queue holds, and runs + the block a second time. Building the block here keeps the vector's input + exactly what the case describes, including inputs a miner would never pick. + """ + create_time = spec["timestamp"] + coinbase = _addr(spec.get("coinbase", C), spec.get("coinbase_full_shard_key", state.full_shard_id)) + block = state.get_tip().create_block_to_append( + create_time=create_time, + address=coinbase, + difficulty=state.get_next_block_difficulty(create_time), + ) + block.header.hash_prev_root_block = state.root_tip.get_hash() + gas_limit, xshard_gas_limit = state.get_gas_limit_all( + spec.get("gas_limit"), spec.get("xshard_gas_limit") + ) + block.header.evm_gas_limit = gas_limit + block.meta.evm_xshard_gas_limit = xshard_gas_limit + for tx_spec in spec.get("txs", []): + block.add_tx(TypedTransaction(SerializedEvmTransaction.from_evm_tx(build_tx(tx_spec, qkc_config)))) + return block + + +def dump_cursor(info): + return { + "root_block_height": info.root_block_height, + "minor_block_index": info.minor_block_index, + "xshard_deposit_index": info.xshard_deposit_index, + } + + +def build_block_case(case): + network_name = case["network"] + state, genesis_root_block = make_shard_state(network_name, case) + qkc_config = state.env.quark_chain_config + + genesis_block = state.db.get_minor_block_by_height(0) + recipients = {a[:40] for a in case["genesis_alloc"]} + + # The genesis root block is where every cursor starts: the shard's genesis + # meta names its height, and the traversal's first deposit is that block's + # own coinbase deposit. + root_blocks = [ + { + "height": genesis_root_block.header.height, + "hash": _hex(genesis_root_block.header.get_hash()), + "block": _hex(genesis_root_block.serialize()), + } + ] + xshard_lists = [] + blocks = [] + + for step in case["blocks"]: + for root_spec in step.get("root_blocks", []): + add_root_block(state, root_spec, root_blocks, xshard_lists) + + block = build_minor_block(state, step, qkc_config) + recipients.add(block.header.coinbase_address.recipient.hex()) + for tx in block.tx_list: + evm_tx = tx.tx.to_evm_tx() + recipients.add(evm_tx.sender.hex()) + if evm_tx.to: + recipients.add(evm_tx.to.hex()) + for entry in xshard_lists: + for deposit in entry["deposits"]: + recipients.add(deposit["from"][2:]) + recipients.add(deposit["to"][2:]) + + expect = step.get("expect", "success") + if expect not in ("success", "rejected"): + raise SystemExit("case {}: expect must be success or rejected".format(case["name"])) + + consumed = [] + if expect == "rejected": + try: + state.run_block(block, consumed) + except Exception as exc: # noqa: BLE001 - the rejection is the vector + blocks.append( + { + "comment": step.get("comment", ""), + "expect": "rejected", + "block": _hex(block.serialize()), + "result": { + "rejected": True, + "error_type": type(exc).__name__, + "error": str(exc), + }, + } + ) + break + raise SystemExit( + "case {}: expected a rejection, the block ran".format(case["name"]) + ) + + evm_state = state.run_block(block, consumed) + coinbase_amount_map = state.get_coinbase_amount_map(block.header.height) + coinbase_amount_map.add(evm_state.block_fee_tokens) + block.finalize(evm_state=evm_state, coinbase_amount_map=coinbase_amount_map) + state.add_block( + block, + gas_limit=step.get("gas_limit"), + xshard_gas_limit=step.get("xshard_gas_limit"), + validate_time=False, + ) + + blocks.append( + { + "comment": step.get("comment", ""), + "expect": "success", + "block": _hex(block.serialize()), + "result": { + "post_state_root": _hex(block.meta.hash_evm_state_root), + "receipt_root": _hex(block.meta.hash_evm_receipt_root), + "gas_used": str(block.meta.evm_gas_used), + "xshard_receive_gas_used": str( + block.meta.evm_cross_shard_receive_gas_used + ), + "cursor": dump_cursor(block.meta.xshard_tx_cursor_info), + "coinbase_amount_map": { + str(token): str(value) + for token, value in sorted( + block.header.coinbase_amount_map.balance_map.items() + ) + }, + "bloom": "0x{:0512x}".format(block.header.bloom), + "receipts": [dump_receipt(r) for r in evm_state.receipts], + "xshard_deposit_receipts": [ + dump_receipt(r) for r in evm_state.xshard_deposit_receipts + ], + "produced_deposits": [dump_deposit(d) for d in evm_state.xshard_list], + "consumed_deposits": [dump_deposit(d) for d in consumed], + "accounts": observe(evm_state, recipients, {}), + }, + } + ) + + return { + "name": case["name"], + "comment": case["comment"], + "network": network_name, + "full_shard_id": case["full_shard_id"], + "genesis_alloc": case["genesis_alloc"], + # The genesis block is the first block's parent: its meta carries the + # cursor the first traversal resumes from, and its state root is what a + # consumer must reach by applying the allocation on its own. + "genesis": { + "state_root": _hex(genesis_block.meta.hash_evm_state_root), + "block": _hex(genesis_block.serialize()), + }, + "root_blocks": root_blocks, + "xshard_lists": xshard_lists, + "blocks": blocks, + } + + +def block_cases(): + """Block-level cases: whole minor blocks run through ShardState.run_block.""" + funded = {"balances": {"QKC": "1000000000000000000"}} + devnet_alloc = {SENDER_A + "00000001": funded, SENDER_B + "00000001": funded} + # devnet chain 0 shard 0 is under test; chain 1 shard 0 is the neighbour the + # deposits arrive from. Both chains have SHARD_SIZE 1, so the shard id is + # (chain << 16) | 1. + local, remote = 0x00000001, 0x00010001 + genesis_time = 1556639999 + + def transfer(nonce, value, signer="A", to=None, gas=21000, gas_price=1): + return { + "nonce": nonce, + "gas_price": gas_price, + "start_gas": gas, + "to": to or (SENDER_B if signer == "A" else SENDER_A), + "value": value, + "signer": signer, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + } + + def deposit(tag, value, gas_remained=0, gas_price=1, to=None): + return { + "tx_hash": "0x" + tag * 32, + "from": SENDER_B, + "from_full_shard_key": remote, + "to": to or SENDER_A, + "to_full_shard_key": local, + "value": str(value), + "gas_price": str(gas_price), + "gas_remained": str(gas_remained), + } + + return [ + { + "name": "devnet_chain_of_three_blocks", + "comment": "three chained blocks of in-shard transfers: each block's " + "state root is the next one's parent, the coinbase collects the " + "reward plus that block's fees, and the sender's nonce advances " + "across blocks", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": devnet_alloc, + "blocks": [ + { + "comment": "one transfer, paid for at gas price 1", + "timestamp": genesis_time + 10, + "txs": [transfer(0, "1000")], + }, + { + "comment": "two transfers from the same sender, in nonce order", + "timestamp": genesis_time + 20, + "txs": [transfer(1, "2000"), transfer(2, "3000")], + }, + { + "comment": "an empty block still pays the coinbase reward", + "timestamp": genesis_time + 30, + "txs": [], + }, + ], + }, + { + "name": "devnet_xshard_deposits_received", + "comment": "a root block confirming a neighbour's minor block hands " + "this shard two deposits; the next block consumes both and the " + "cursor lands past them", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": devnet_alloc, + "blocks": [ + { + "comment": "root block 1 exists only so the neighbour's header " + "can point at a root height above this shard's genesis root " + "height, which is what gives it permission to send", + "timestamp": genesis_time + 10, + "root_blocks": [{"minor_headers": [{"local_tip": True}]}], + "txs": [], + }, + { + "comment": "root block 2 confirms the neighbour's block, so its " + "deposits are what this block receives before any transaction", + "timestamp": genesis_time + 20, + "root_blocks": [ + { + "minor_headers": [ + { + "full_shard_id": remote, + "height": 1, + "deposits": [ + deposit("11", 500), + deposit("22", 700), + ], + } + ] + } + ], + "txs": [], + }, + ], + }, + { + "name": "devnet_xshard_cursor_splits_across_blocks", + "comment": "the cross-shard allowance is one deposit wide, so a root " + "block carrying three of them is consumed over three blocks: each " + "block stops on the soft limit and the next resumes from the cursor " + "the previous one published (shard_state.py:1637)", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": devnet_alloc, + "blocks": [ + { + "timestamp": genesis_time + 10, + "root_blocks": [{"minor_headers": [{"local_tip": True}]}], + "txs": [], + }, + { + "comment": "first slice: one deposit, cursor stops inside the " + "neighbour's list", + "timestamp": genesis_time + 20, + "xshard_gas_limit": 9000, + "root_blocks": [ + { + "minor_headers": [ + { + "full_shard_id": remote, + "height": 1, + "deposits": [ + deposit("11", 100), + deposit("22", 200), + deposit("33", 300), + ], + } + ] + } + ], + "txs": [], + }, + { + "comment": "second slice, resumed from the published cursor", + "timestamp": genesis_time + 30, + "xshard_gas_limit": 9000, + "txs": [], + }, + { + "comment": "third slice takes the last deposit; the soft limit " + "breaks the loop on it, so the cursor stops on the deposit " + "rather than past the root block", + "timestamp": genesis_time + 40, + "xshard_gas_limit": 9000, + "txs": [], + }, + ], + }, + { + "name": "devnet_root_chain_coinbase_deposit", + "comment": "every root block the cursor passes produces a deposit for " + "its own coinbase address, credited only when that address is in " + "this shard (shard_state.py:110-137). The first root block's " + "coinbase is in this shard, the second's is in the neighbour, and " + "the second still produces a zero-value deposit", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": devnet_alloc, + "blocks": [ + { + "timestamp": genesis_time + 10, + "root_blocks": [ + { + "minor_headers": [{"local_tip": True}], + "coinbase": { + "address": A, + "full_shard_key": local, + "tokens": {"QKC": "120000"}, + }, + } + ], + "txs": [], + }, + { + "timestamp": genesis_time + 20, + "root_blocks": [ + { + "minor_headers": [], + "coinbase": { + "address": A, + "full_shard_key": remote, + "tokens": {"QKC": "120000"}, + }, + } + ], + "txs": [], + }, + ], + }, + { + "name": "devnet_xshard_before_transactions", + "comment": "a block with both halves: the deposits are credited before " + "the transactions run, which is what lets the sender spend what it " + "only just received in the same block", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": {SENDER_B + "00000001": funded}, + "blocks": [ + { + "timestamp": genesis_time + 10, + "root_blocks": [{"minor_headers": [{"local_tip": True}]}], + "txs": [], + }, + { + "comment": "A holds nothing at the start of the block and pays " + "for this transfer out of the deposit", + "timestamp": genesis_time + 20, + "root_blocks": [ + { + "minor_headers": [ + { + "full_shard_id": remote, + "height": 1, + "deposits": [deposit("11", 10000000)], + } + ] + } + ], + "txs": [transfer(0, "1000")], + }, + ], + }, + { + "name": "devnet_native_token_gas_real_manager", + "comment": "the real general native token manager, driven through its " + "own interface: register QETH, propose an exchange rate of 1/30000 " + "with a genesis-token deposit, set the refund rate to 60, then send " + "a transaction that pays its gas in QETH at 60000 — which the " + "contract prices at 2 (test_shard_state.py:3369)", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": { + SENDER_A + "00000001": { + "balances": {"QKC": "1000000000000000000", "QETH": "10000000000"} + }, + GENERAL_NATIVE_TOKEN_ADDRESS + "00000001": { + "balances": {}, + "code": general_native_token_runtime(), + "storage": { + # caller, supervisor, minimum reserve to maintain, + # minimum reserve to start with. + "0x00": "0x" + GENERAL_NATIVE_TOKEN_ADDRESS.rjust(64, "0"), + "0x01": "0x" + SENDER_A.rjust(64, "0"), + "0x03": "0x" + word(30000), + "0x04": "0x" + word(1), + }, + }, + }, + "blocks": [ + { + "comment": "the three admin calls, in the order the contract " + "requires: nothing can be proposed for an unregistered token", + "timestamp": genesis_time + 10, + "txs": [ + { + "nonce": 0, + "gas_price": 0, + "start_gas": 1000000, + "to": GENERAL_NATIVE_TOKEN_ADDRESS, + "value": "1", + "signer": "A", + "transfer_token": "QETH", + "data": "0xbf03314a", + "from_full_shard_key": 1, + "to_full_shard_key": 1, + }, + { + "nonce": 1, + "gas_price": 0, + "start_gas": 1000000, + "to": GENERAL_NATIVE_TOKEN_ADDRESS, + "value": "100000", + "signer": "A", + "data": "0x735e0e19" + + word(1280249) + + word(1) + + word(30000), + "from_full_shard_key": 1, + "to_full_shard_key": 1, + }, + { + "nonce": 2, + "gas_price": 0, + "start_gas": 1000000, + "to": GENERAL_NATIVE_TOKEN_ADDRESS, + "value": "0", + "signer": "A", + "data": "0x6d27af8c" + word(1280249) + word(60), + "from_full_shard_key": 1, + "to_full_shard_key": 1, + }, + ], + }, + { + "comment": "gas paid in QETH, priced by the contract: 60000 " + "QETH per gas becomes 2 QKC per gas, and 60% of the unused " + "gas comes back", + "timestamp": genesis_time + 20, + "txs": [ + { + "nonce": 3, + "gas_price": 60000, + "start_gas": 30000, + "to": SENDER_B, + "value": "12345", + "signer": "A", + "gas_token": "QETH", + "transfer_token": "QETH", + "from_full_shard_key": 1, + "to_full_shard_key": 1, + } + ], + }, + ], + }, + { + "name": "devnet_native_token_gas_block", + "comment": "a whole block whose transaction pays gas in QETH: the " + "manager's sale, the refund at the rate it named and the burn of the " + "remainder all land in the block's state root, while the coinbase " + "map stays in the genesis token", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": { + SENDER_A + "00000001": {"balances": {"QETH": "10000000"}}, + GENERAL_NATIVE_TOKEN_ADDRESS + "00000001": { + "balances": {"QKC": "1000000000000000000"}, + "code": MANAGER_RATE_80_PRICE_2, + }, + }, + "blocks": [ + { + "timestamp": genesis_time + 10, + "txs": [ + { + "nonce": 0, + "gas_price": 3, + "start_gas": 30000, + "to": SENDER_B, + "value": "12345", + "signer": "A", + "gas_token": "QETH", + "transfer_token": "QETH", + "from_full_shard_key": 1, + "to_full_shard_key": 1, + } + ], + }, + ], + }, + { + "name": "devnet_selfdestruct_coinbase_resurrected_by_reward", + "comment": "SELFDESTRUCT does not delete the account: del_account " + "strips it once the message is over (messages.py:351), and the " + "end-of-block sweep decides whether the leaf survives. Here the " + "stripped account is the block's own coinbase, so the reward paid " + "at the end of run_block brings it back — Ethereum's unconditional " + "delete would drop it together with the reward", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": { + "balances": {"QKC": "5000"}, + "code": selfdestruct_runtime(B), + }, + }, + "blocks": [ + { + "timestamp": genesis_time + 10, + "coinbase": A, + "txs": [ + { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": "0", + "signer": "A", + "from_full_shard_key": 1, + "to_full_shard_key": 1, + } + ], + }, + ], + }, + { + "name": "devnet_selfdestruct_then_paid_again", + "comment": "the same rule inside one block: the account is stripped " + "by the transaction that destroys it and brought back by the next " + "transaction that pays it", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": { + "balances": {"QKC": "5000"}, + "code": selfdestruct_runtime(B), + }, + }, + "blocks": [ + { + "timestamp": genesis_time + 10, + "txs": [ + { + "nonce": 0, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": "0", + "signer": "A", + "from_full_shard_key": 1, + "to_full_shard_key": 1, + }, + { + "nonce": 1, + "gas_price": 1, + "start_gas": 200000, + "to": A, + "value": "777", + "signer": "A", + "from_full_shard_key": 1, + "to_full_shard_key": 1, + }, + ], + }, + ], + }, + { + "name": "devnet_block_rejected_bad_nonce", + "comment": "a block carrying a transaction whose nonce is far ahead is " + "refused whole: run_block re-validates every transaction and raises " + "on the first failure, so nothing the block did is published", + "network": "devnet", + "full_shard_id": local, + "genesis_alloc": devnet_alloc, + "blocks": [ + { + "timestamp": genesis_time + 10, + "expect": "rejected", + "txs": [transfer(99, "1000")], + } + ], + }, + { + "name": "mainnet_xshard_across_evm_switch", + "comment": "the same deposit shape on both sides of " + "ENABLE_EVM_TIMESTAMP: before it the value is handed straight to the " + "recipient with no receipt, at it the deposit runs as an EVM message " + "and produces one (shard_state.py:1591, messages.py:368)", + "network": "mainnet", + "full_shard_id": local, + "genesis_alloc": devnet_alloc, + "blocks": [ + { + "timestamp": 1569567590, + "root_blocks": [{"minor_headers": [{"local_tip": True}]}], + "txs": [], + }, + { + "comment": "pre-EVM: one second before the switch", + "timestamp": 1569567599, + "root_blocks": [ + { + "minor_headers": [ + { + "full_shard_id": remote, + "height": 1, + "deposits": [deposit("11", 500)], + } + ] + } + ], + "txs": [], + }, + { + "comment": "post-EVM: the switch is a >= on the block timestamp", + "timestamp": 1569567600, + "root_blocks": [ + { + "minor_headers": [ + { + "full_shard_id": remote, + "height": 2, + "deposits": [deposit("22", 500)], + } + ] + } + ], + "txs": [], + }, + ], + }, + ] + + +# --------------------------------------------------------------------------- +# entry point + + +def check_genesis_selfcheck(state_vectors): + """The genesis cases must land on the pinned minor genesis state roots.""" + with open(os.path.join(_TESTDATA_DIR, "minor_genesis_golden.json")) as f: + pinned = {n["name"]: n for n in json.load(f)["networks"]} + for vector in state_vectors: + if not vector["name"].startswith("genesis_alloc_"): + continue + network = vector["name"][len("genesis_alloc_") :] + want = pinned[network]["state_root"] + got = vector["post_state_root"] + if got != want: + raise SystemExit( + "genesis self-check failed for {}: state root {} != pinned {}".format( + network, got, want + ) + ) + + +def write(filename, comment, source, vectors): + path = os.path.join(_OUT_DIR, filename) + with open(path, "w") as f: + json.dump( + {"_comment": comment, "source": source, "cases": vectors}, + f, + indent=2, + sort_keys=False, + ) + f.write("\n") + print("wrote {} ({} cases)".format(path, len(vectors))) + + +def main(): + os.makedirs(_OUT_DIR, exist_ok=True) + source = oracle_provenance() + networks = load_networks() + + state_vectors = [build_state_case(networks, c) for c in state_cases(networks)] + check_genesis_selfcheck(state_vectors) + write( + "state_level.json", + [ + "Direct EvmState mutations and the state root they commit to, generated by", + "qkc/testdata/gen_exec_golden.py against pyquarkchain. The genesis_alloc_*", + "cases are the generator's self-check against minor_genesis_golden.json.", + "Allocations are committed before a case's operations run, so the", + "operations start from a state that has been through the trie.", + ], + source, + state_vectors, + ) + + message_vectors = [build_message_case(networks, c) for c in message_cases()] + write( + "message_level.json", + [ + "Single transactions and cross-shard deposits driven through", + "apply_transaction / apply_xshard_deposit, generated by", + "qkc/testdata/gen_exec_golden.py against pyquarkchain. Each case", + "declares whether it pins a successful execution or a rejection.", + ], + source, + message_vectors, + ) + + block_vectors = [build_block_case(c) for c in block_cases()] + write( + "block_level.json", + [ + "Whole minor blocks run through ShardState.run_block, generated by", + "qkc/testdata/gen_exec_golden.py against pyquarkchain. A case is a", + "genesis allocation, a root chain built up alongside the shard, and", + "the blocks in order; each block carries the serialized block itself", + "and every consensus output running it produced. The allocation is", + "the shard's GENESIS.ALLOC, so a consumer reaches the genesis state", + "root by applying it and nothing else.", + ], + source, + block_vectors, + ) + + +async def run(): + """Generate inside an event loop. + + Nothing here is asynchronous, but ShardState.add_block announces new heads + and logs through asyncio.create_task (shard_state.py:286), which needs a + running loop. Yielding once at the end lets those announcements run against + the empty subscription manager instead of being destroyed pending. + """ + main() + await asyncio.sleep(0) + + +if __name__ == "__main__": + asyncio.run(run()) From d4c9f9743c0feb63b563fee7ac3a54b177edc5ff Mon Sep 17 00:00:00 2001 From: syntrust Date: Fri, 21 Aug 2026 17:08:58 +0800 Subject: [PATCH 2/4] qkc/testdata: pin the state, message and block level execution vectors The three files gen_exec_golden.py writes, generated against pyquarkchain master 75f8d7e1 with no oracle module modified: - state_level.json, 17 cases: direct EvmState mutations, pinning the post state root and per-account reads. The first two are the generator's own calibration against minor_genesis_golden.json. - message_level.json, 41 cases: one signed transaction or one cross-shard deposit through apply_transaction / apply_xshard_deposit, pinning the post root, receipts, gas counters, produced deposits and coinbase fees. Each case declares whether it pins a successful execution or a rejection, and a rejection names the pyquarkchain exception it must be attributed to. - block_level.json, 11 cases: whole minor blocks through ShardState.run_block, pinning the seven values a block commits to and the cross-shard deposits it consumed. Nothing in the tree reads these yet. They are the reference the Go execution layer is written against, and its consumers arrive with it. Co-Authored-By: Claude Opus 5 --- qkc/testdata/exec_golden/block_level.json | 2533 ++++++++++++ qkc/testdata/exec_golden/message_level.json | 4031 +++++++++++++++++++ qkc/testdata/exec_golden/state_level.json | 779 ++++ 3 files changed, 7343 insertions(+) create mode 100644 qkc/testdata/exec_golden/block_level.json create mode 100644 qkc/testdata/exec_golden/message_level.json create mode 100644 qkc/testdata/exec_golden/state_level.json diff --git a/qkc/testdata/exec_golden/block_level.json b/qkc/testdata/exec_golden/block_level.json new file mode 100644 index 00000000000..82fb0bc5b52 --- /dev/null +++ b/qkc/testdata/exec_golden/block_level.json @@ -0,0 +1,2533 @@ +{ + "_comment": [ + "Whole minor blocks run through ShardState.run_block, generated by", + "qkc/testdata/gen_exec_golden.py against pyquarkchain. A case is a", + "genesis allocation, a root chain built up alongside the shard, and", + "the blocks in order; each block carries the serialized block itself", + "and every consensus output running it produced. The allocation is", + "the shard's GENESIS.ALLOC, so a consumer reaches the genesis state", + "root by applying it and nothing else." + ], + "source": { + "pyquarkchain_commit": "75f8d7e166df0f5a2579ffe37ea7b4f5ba79db60", + "dirty_modules": [], + "module_digests": { + "quarkchain/evm/messages.py": "7d6cb97202b0e5e7", + "quarkchain/evm/state.py": "de5216e6c10e606e", + "quarkchain/evm/transactions.py": "573f578989e912a1", + "quarkchain/evm/specials.py": "c14638312c952401", + "quarkchain/evm/opcodes.py": "40d1eaab9bb6612a", + "quarkchain/cluster/shard_state.py": "9cc7a3ff57b383b5", + "quarkchain/core.py": "3f6d1865eb449b80", + "quarkchain/genesis.py": "15d80022b9b6aa0b", + "quarkchain/config.py": "cda1b5ca536bb8af", + "quarkchain/utils.py": "33ec76129f0d8269" + } + }, + "cases": [ + { + "name": "devnet_chain_of_three_blocks", + "comment": "three chained blocks of in-shard transfers: each block's state root is the next one's parent, the coinbase collects the reward plus that block's fees, and the sender's nonce advances across blocks", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "1563915e194d8cfba1943570603f7606a311550800000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "genesis": { + "state_root": "0x20dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [], + "blocks": [ + { + "comment": "one transfer, paid for at gas price 1", + "expect": "success", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e00529043fde4f62fa737a7e25d8473639630ee533cc353800eef4a02141609d1a9592bf5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b00675dcde89c986be59d4d4e863b32c9c06f82940c4c27c26b06c52f038907c56b000000005cc8710905012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002532ff31549454cb6e4b53810e80d1f6779f83e62a373b07197cbfca6c2ef8b11b847a9513c40d61f20ac7beb30333f171264ac36494b96ced71a3d151fae964ac128a85e52d212792962e3cb631d175cd9bb92da40154e1c28d955a300f32370000000000000000000000000000000000000000000000000000000000005208000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000010000000076f8748001825208941563915e194d8cfba1943570603f7606a31155088203e88081ff84000000018400000001828bb0828bb0801ba03f9f5691ecf617db3ef5279fe84c116176193802e10796c184bf9c6084e86302a045f7413a9c7e4d497d44a01a6a017eec82371f3621c7f5818adf16a46ce50d6b0000", + "result": { + "post_state_root": "0x1b847a9513c40d61f20ac7beb30333f171264ac36494b96ced71a3d151fae964", + "receipt_root": "0xac128a85e52d212792962e3cb631d175cd9bb92da40154e1c28d955a300f3237", + "gas_used": "21000", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 1, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000010500" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000001000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999978000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "3250000000000010500" + } + } + } + } + }, + { + "comment": "two transfers from the same sender, in nonce order", + "expect": "success", + "block": "0x00000000000000010000000000000002cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e00552082330903960df68d5b740624357432e1557d2cb62d225c751839f76f55343b4745ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b0068ee88a75bb5798e6811f9cdc03de01bc5d5dc7bf7d314fa229b511954176afc000000005cc8711305012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a95bab08b2b9621f771802f19fc8134181438ded6c2fe7b611a2e3df47014ab305572d644d3e9d8343924cc83d09de33e7925594b631c70613b52e7e6c1c4c86bf8137c5815fa5b11f41eee944849035961ab6ef764952990e841755b318bd8000000000000000000000000000000000000000000000000000000000000a410000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000020000000076f8740101825208941563915e194d8cfba1943570603f7606a31155088207d08081ff84000000018400000001828bb0828bb0801ba0d13517ad0f938d6814593a157822a15fb3b156b44588c0724d79dafd122a6b06a06ccc30c9519311365872af10ec8268ee1e73d750f0334b049019a36554ea651b0000000076f8740201825208941563915e194d8cfba1943570603f7606a3115508820bb88081ff84000000018400000001828bb0828bb0801ca0fe6a3a2d963663668c4427647c015cebde04ed9fa51c152ed2f2d247433ec1dfa065ee13d798fb1248396e1304b2d06def3696a7dc108466d23ef2e2c5725985840000", + "result": { + "post_state_root": "0x305572d644d3e9d8343924cc83d09de33e7925594b631c70613b52e7e6c1c4c8", + "receipt_root": "0x6bf8137c5815fa5b11f41eee944849035961ab6ef764952990e841755b318bd8", + "gas_used": "42000", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 1, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000021000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 42000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "produced_deposits": [], + "consumed_deposits": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000006000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 3, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999931000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "6500000000000031500" + } + } + } + } + }, + { + "comment": "an empty block still pays the coinbase reward", + "expect": "success", + "block": "0x00000000000000010000000000000003cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e00500003a72fe81d68fd06e8d90a0e0c84ffe7dc60ac54f30ad2f4bdaccd8783e7746d35ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b003a5a43ed91aa6d6391a5f97088083de7296d1d12ca05bc969230d88083c3f6c9000000005cc8711d05012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9bfa54bdc996a0717729b4ac3c811fa59ca5d17ada9c8a2d4f106a21f62a28e15a56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0xfa54bdc996a0717729b4ac3c811fa59ca5d17ada9c8a2d4f106a21f62a28e15a", + "receipt_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "gas_used": "0", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 1, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000000000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [], + "produced_deposits": [], + "consumed_deposits": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000006000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 3, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999931000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "9750000000000031500" + } + } + } + } + } + ] + }, + { + "name": "devnet_xshard_deposits_received", + "comment": "a root block confirming a neighbour's minor block hands this shard two deposits; the next block consumes both and the cursor lands past them", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "1563915e194d8cfba1943570603f7606a311550800000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "genesis": { + "state_root": "0x20dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 1, + "hash": "0x5744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e3768", + "block": "0x00000000000000015ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d05a3cb0fba082755d56d359069a4125eab4a08d53f47d49f2f8016ac590ce89c56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42100000000000000000000000000000000000000000000000000000000000000005cc87100030186a003030d400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e7300000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 2, + "hash": "0xf96bc387924a6ff6ae44ca5fcd013235cc40a8960c4ff32a450051ae5cd1a96b", + "block": "0x00000000000000025744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e3768a97bde93cf61369e2b53cdda1e9f2f1ee38dbc6cf16f4df57270c65b56c08ccb56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42100000000000000000000000000000000000000000000000000000000000000005cc87101030186a0030493e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000001000100000000000000010000000000000000000000000000000000000000000100010000000000000000000000000000000000000000000000000000000000000000000000005744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e37680000000000000000000000000000000000000000000000000000000000b71b00000000000000000000000000000000000000000000000000000000000000000000000000000000010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [ + { + "minor_block_hash": "0xaf13003602030d47a605f210e0deb5b2af18bd18e6657c57da9d212f61419438", + "full_shard_id": 65537, + "deposits": [ + { + "tx_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "500", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + }, + { + "tx_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "700", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ] + } + ], + "blocks": [ + { + "comment": "root block 1 exists only so the neighbour's header can point at a root height above this shard's genesis root height, which is what gives it permission to send", + "expect": "success", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e00500003fde4f62fa737a7e25d8473639630ee533cc353800eef4a02141609d1a9592bf5744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e37680000000000000000000000000000000000000000000000000000000000b71b0034d179e6278f01de5381e4ecc0da971fc266775a62460f17e6dea411d99c02ab000000005cc8710905012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9bf36b6b6af6b75ce778225a6de048a0b9e0f3fa6ea7aed2e14ce7199b49207e4f71fb6c80e91c9d463c1a261df541b2ebbbf38e7dfaf7870507305dad4e289c4b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0xf36b6b6af6b75ce778225a6de048a0b9e0f3fa6ea7aed2e14ce7199b49207e4f", + "receipt_root": "0x71fb6c80e91c9d463c1a261df541b2ebbbf38e7dfaf7870507305dad4e289c4b", + "gas_used": "0", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 2, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000000000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0x5744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e3768", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "3250000000000000000" + } + } + } + } + }, + { + "comment": "root block 2 confirms the neighbour's block, so its deposits are what this block receives before any transaction", + "expect": "success", + "block": "0x00000000000000010000000000000002cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e0052328035db1416ee26d5ffc7e05ad5a2f63668d30623ad36363e844c5a05325883bc0f96bc387924a6ff6ae44ca5fcd013235cc40a8960c4ff32a450051ae5cd1a96b0000000000000000000000000000000000000000000000000000000000b71b0054c420570a959812ea829bdb5c928bf2f40af8a40704f95a1154f780b5087323000000005cc8711305012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9b1de5a2970e38a66e182b65e3e04bc41ffa72fbc96b944f126c7c68a9846f15c3c49a14fc93de2b5d911f2f09d09b747fd470e123aaa595ea88faa5f82ad5cb8b0000000000000000000000000000000000000000000000000000000000004650000000000000000000000000000000000000000000000000000000000000465000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0x1de5a2970e38a66e182b65e3e04bc41ffa72fbc96b944f126c7c68a9846f15c3", + "receipt_root": "0xc49a14fc93de2b5d911f2f09d09b747fd470e123aaa595ea88faa5f82ad5cb8b", + "gas_used": "18000", + "xshard_receive_gas_used": "18000", + "cursor": { + "root_block_height": 3, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000009000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 9000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 18000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0xf96bc387924a6ff6ae44ca5fcd013235cc40a8960c4ff32a450051ae5cd1a96b", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "500", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + }, + { + "tx_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "700", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000001200" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "6500000000000009000" + } + } + } + } + } + ] + }, + { + "name": "devnet_xshard_cursor_splits_across_blocks", + "comment": "the cross-shard allowance is one deposit wide, so a root block carrying three of them is consumed over three blocks: each block stops on the soft limit and the next resumes from the cursor the previous one published (shard_state.py:1637)", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "1563915e194d8cfba1943570603f7606a311550800000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "genesis": { + "state_root": "0x20dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 1, + "hash": "0x5744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e3768", + "block": "0x00000000000000015ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d05a3cb0fba082755d56d359069a4125eab4a08d53f47d49f2f8016ac590ce89c56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42100000000000000000000000000000000000000000000000000000000000000005cc87100030186a003030d400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e7300000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 2, + "hash": "0xf96bc387924a6ff6ae44ca5fcd013235cc40a8960c4ff32a450051ae5cd1a96b", + "block": "0x00000000000000025744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e3768a97bde93cf61369e2b53cdda1e9f2f1ee38dbc6cf16f4df57270c65b56c08ccb56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42100000000000000000000000000000000000000000000000000000000000000005cc87101030186a0030493e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000001000100000000000000010000000000000000000000000000000000000000000100010000000000000000000000000000000000000000000000000000000000000000000000005744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e37680000000000000000000000000000000000000000000000000000000000b71b00000000000000000000000000000000000000000000000000000000000000000000000000000000010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [ + { + "minor_block_hash": "0xaf13003602030d47a605f210e0deb5b2af18bd18e6657c57da9d212f61419438", + "full_shard_id": 65537, + "deposits": [ + { + "tx_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "100", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + }, + { + "tx_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "200", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + }, + { + "tx_hash": "0x3333333333333333333333333333333333333333333333333333333333333333", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "300", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ] + } + ], + "blocks": [ + { + "comment": "", + "expect": "success", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e00500003fde4f62fa737a7e25d8473639630ee533cc353800eef4a02141609d1a9592bf5744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e37680000000000000000000000000000000000000000000000000000000000b71b0034d179e6278f01de5381e4ecc0da971fc266775a62460f17e6dea411d99c02ab000000005cc8710905012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9bf36b6b6af6b75ce778225a6de048a0b9e0f3fa6ea7aed2e14ce7199b49207e4f71fb6c80e91c9d463c1a261df541b2ebbbf38e7dfaf7870507305dad4e289c4b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0xf36b6b6af6b75ce778225a6de048a0b9e0f3fa6ea7aed2e14ce7199b49207e4f", + "receipt_root": "0x71fb6c80e91c9d463c1a261df541b2ebbbf38e7dfaf7870507305dad4e289c4b", + "gas_used": "0", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 2, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000000000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0x5744906deb1f8a2d87f14fc3ab86a7df59ecc459d13369fec0b72b0fe30e3768", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "3250000000000000000" + } + } + } + } + }, + { + "comment": "first slice: one deposit, cursor stops inside the neighbour's list", + "expect": "success", + "block": "0x00000000000000010000000000000002cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e0051194035db1416ee26d5ffc7e05ad5a2f63668d30623ad36363e844c5a05325883bc0f96bc387924a6ff6ae44ca5fcd013235cc40a8960c4ff32a450051ae5cd1a96b0000000000000000000000000000000000000000000000000000000000b71b006e905d4862adcdc53a969a0df90eb8c63acf379e36793305829f32b9e594a3bf000000005cc8711305012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9b4b3b2e58c4ae389eb356132cd608b0557c3358e863f3538d6178a99d905c32d8a855176b0a068223b513d11cbdef93a8d2fbeec0e7a353e8fe8a3479588356fb000000000000000000000000000000000000000000000000000000000000232800000000000000000000000000000000000000000000000000000000000023280000000000000002000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000002328000000000000", + "result": { + "post_state_root": "0x4b3b2e58c4ae389eb356132cd608b0557c3358e863f3538d6178a99d905c32d8", + "receipt_root": "0xa855176b0a068223b513d11cbdef93a8d2fbeec0e7a353e8fe8a3479588356fb", + "gas_used": "9000", + "xshard_receive_gas_used": "9000", + "cursor": { + "root_block_height": 2, + "minor_block_index": 1, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000004500" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 9000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0xf96bc387924a6ff6ae44ca5fcd013235cc40a8960c4ff32a450051ae5cd1a96b", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "100", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000100" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "6500000000000004500" + } + } + } + } + }, + { + "comment": "second slice, resumed from the published cursor", + "expect": "success", + "block": "0x00000000000000010000000000000003cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e0051194ef822a3c010eff32fcd8022c0a55c0c0b02cdbc4ca5af5ca08ca2a3ce768b7c0f96bc387924a6ff6ae44ca5fcd013235cc40a8960c4ff32a450051ae5cd1a96b0000000000000000000000000000000000000000000000000000000000b71b0015e581c068b22b930d084d9fa22af6abfaaff58f6881aeeaeb717c94887e399d000000005cc8711d05012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9b8242a679cc6a908ee6dcc694fa12142dbec42409a6c85bd207a1226b210d985f5cad5d3aebebe8fe068f75ebbc3c386dbe0ed93c3ec230ab50ba6f56bd21aca2000000000000000000000000000000000000000000000000000000000000232800000000000000000000000000000000000000000000000000000000000023280000000000000002000000000000000100000000000000010000000000000000000000000000000000000000000000000000000000002328000000000000", + "result": { + "post_state_root": "0x8242a679cc6a908ee6dcc694fa12142dbec42409a6c85bd207a1226b210d985f", + "receipt_root": "0x5cad5d3aebebe8fe068f75ebbc3c386dbe0ed93c3ec230ab50ba6f56bd21aca2", + "gas_used": "9000", + "xshard_receive_gas_used": "9000", + "cursor": { + "root_block_height": 2, + "minor_block_index": 1, + "xshard_deposit_index": 1 + }, + "coinbase_amount_map": { + "35760": "3250000000000004500" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 9000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "200", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000300" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "9750000000000009000" + } + } + } + } + }, + { + "comment": "third slice takes the last deposit; the soft limit breaks the loop on it, so the cursor stops on the deposit rather than past the root block", + "expect": "success", + "block": "0x00000000000000010000000000000004cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e0051194549f789e6d0793ab4e013619844e69116a942936202f2703386141798fb92662f96bc387924a6ff6ae44ca5fcd013235cc40a8960c4ff32a450051ae5cd1a96b0000000000000000000000000000000000000000000000000000000000b71b00863a873041e7877870a625319b3127980be77c19e7918ac057cc6948229eefe5000000005cc8712705012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9bbeedf215da753ce636f6cc254a084d1739fdb0c6851a719db3365eb2592670895cad5d3aebebe8fe068f75ebbc3c386dbe0ed93c3ec230ab50ba6f56bd21aca2000000000000000000000000000000000000000000000000000000000000232800000000000000000000000000000000000000000000000000000000000023280000000000000002000000000000000100000000000000020000000000000000000000000000000000000000000000000000000000002328000000000000", + "result": { + "post_state_root": "0xbeedf215da753ce636f6cc254a084d1739fdb0c6851a719db3365eb259267089", + "receipt_root": "0x5cad5d3aebebe8fe068f75ebbc3c386dbe0ed93c3ec230ab50ba6f56bd21aca2", + "gas_used": "9000", + "xshard_receive_gas_used": "9000", + "cursor": { + "root_block_height": 2, + "minor_block_index": 1, + "xshard_deposit_index": 2 + }, + "coinbase_amount_map": { + "35760": "3250000000000004500" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 9000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x3333333333333333333333333333333333333333333333333333333333333333", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "300", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000600" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "13000000000000013500" + } + } + } + } + } + ] + }, + { + "name": "devnet_root_chain_coinbase_deposit", + "comment": "every root block the cursor passes produces a deposit for its own coinbase address, credited only when that address is in this shard (shard_state.py:110-137). The first root block's coinbase is in this shard, the second's is in the neighbour, and the second still produces a zero-value deposit", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "1563915e194d8cfba1943570603f7606a311550800000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "genesis": { + "state_root": "0x20dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 1, + "hash": "0x869e53c1c2530eb2a9be72eb59e7fc86d4b7617e244ff51a7150dc50db227aed", + "block": "0x00000000000000015ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d05a3cb0fba082755d56d359069a4125eab4a08d53f47d49f2f8016ac590ce89c56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421aaaa0000000000000000000000000000000000aa0000000100000001028bb00301d4c0000000005cc87100030186a003030d400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e7300000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 2, + "hash": "0xcfdd68de99be6037c42891ee7784819a36489c95e76afdb1180e39270af00f0b", + "block": "0x0000000000000002869e53c1c2530eb2a9be72eb59e7fc86d4b7617e244ff51a7150dc50db227aeddaa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9b56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421aaaa0000000000000000000000000000000000aa0001000100000001028bb00301d4c0000000005cc87101030186a0030493e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [], + "blocks": [ + { + "comment": "", + "expect": "success", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e00500003fde4f62fa737a7e25d8473639630ee533cc353800eef4a02141609d1a9592bf869e53c1c2530eb2a9be72eb59e7fc86d4b7617e244ff51a7150dc50db227aed0000000000000000000000000000000000000000000000000000000000b71b009ec43823e86024546e5b065dbe69450707ce9479d015cdc19544516dac7aa146000000005cc8710905012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9b50bf5c46ce91e7d04a2b7359755bb9ee4d9faac449481f3291fa02c0a617344cbe04b190b5e2e115ffe28c0dfb85ac53f0177a9044d3832692a2f5adfc5d8f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0x50bf5c46ce91e7d04a2b7359755bb9ee4d9faac449481f3291fa02c0a617344c", + "receipt_root": "0xbe04b190b5e2e115ffe28c0dfb85ac53f0177a9044d3832692a2f5adfc5d8f60", + "gas_used": "0", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 2, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000000000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0x869e53c1c2530eb2a9be72eb59e7fc86d4b7617e244ff51a7150dc50db227aed", + "from": "0xaaaa0000000000000000000000000000000000aa", + "from_full_shard_key": 1, + "to": "0xaaaa0000000000000000000000000000000000aa", + "to_full_shard_key": 1, + "value": "120000", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "3250000000000000000" + } + } + } + } + }, + { + "comment": "", + "expect": "success", + "block": "0x00000000000000010000000000000002cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e005000022443db688dbc7bddce903ed74c96d31a42c91455a9dcbc256617bcfef2ecf63cfdd68de99be6037c42891ee7784819a36489c95e76afdb1180e39270af00f0b0000000000000000000000000000000000000000000000000000000000b71b007e84675248bc2f7d320d585db384f941c84ef80c3535da2077e943476f6c221e000000005cc8711305012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9b17e3af2958da3ea6401dd7fb30482fce9d8c7c404abe52bc997384e586e3b66e11a3c9de83f9e0fbded467e0b727846baccc816a27b2fa2f38ecab51efbfb4830000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0x17e3af2958da3ea6401dd7fb30482fce9d8c7c404abe52bc997384e586e3b66e", + "receipt_root": "0x11a3c9de83f9e0fbded467e0b727846baccc816a27b2fa2f38ecab51efbfb483", + "gas_used": "0", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 3, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000000000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 65537, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0xcfdd68de99be6037c42891ee7784819a36489c95e76afdb1180e39270af00f0b", + "from": "0xaaaa0000000000000000000000000000000000aa", + "from_full_shard_key": 65537, + "to": "0xaaaa0000000000000000000000000000000000aa", + "to_full_shard_key": 65537, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "6500000000000000000" + } + } + } + } + } + ] + }, + { + "name": "devnet_xshard_before_transactions", + "comment": "a block with both halves: the deposits are credited before the transactions run, which is what lets the sender spend what it only just received in the same block", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "1563915e194d8cfba1943570603f7606a311550800000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "genesis": { + "state_root": "0xbe6bd3f1fa7620bf11b28d65b8bdd8219272fbdd420ddd9d45875dbc5caa7339", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b002ab613268509e8ccee632e0ccec73618c0f68eba39a684747cdb5181cbc640e7000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000be6bd3f1fa7620bf11b28d65b8bdd8219272fbdd420ddd9d45875dbc5caa733900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 1, + "hash": "0xfd03ec0716d6c3e3bf3b76ed161052b611a244f2c230b90a1459cef44294c7db", + "block": "0x00000000000000015ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780db4c96c246054c1e26bc7c6f87ba02c0047398569c223d4a57a0b34c27b15783b56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42100000000000000000000000000000000000000000000000000000000000000005cc87100030186a003030d400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b002ab613268509e8ccee632e0ccec73618c0f68eba39a684747cdb5181cbc640e7000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e7300000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 2, + "hash": "0xd4f99368df94da96d5ed0001177876f3693bf356f6a8788c3a0b107e7bfb44a3", + "block": "0x0000000000000002fd03ec0716d6c3e3bf3b76ed161052b611a244f2c230b90a1459cef44294c7dbf7d55e3d65c18893510e5a065dd6a183a5907dc4dca648beec060feb95c8408856e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42100000000000000000000000000000000000000000000000000000000000000005cc87101030186a0030493e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000100010000000000000001000000000000000000000000000000000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000fd03ec0716d6c3e3bf3b76ed161052b611a244f2c230b90a1459cef44294c7db0000000000000000000000000000000000000000000000000000000000b71b00000000000000000000000000000000000000000000000000000000000000000000000000000000010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [ + { + "minor_block_hash": "0xcc409f4c2952b4b150c725be59fd05491ef81f8c8ce8b995f7ab01d79b7793e3", + "full_shard_id": 65537, + "deposits": [ + { + "tx_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "10000000", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ] + } + ], + "blocks": [ + { + "comment": "", + "expect": "success", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e0050000a53059571ffdd4a2c933373ad58b19ea5bf54348646e22a3771c67b47548796afd03ec0716d6c3e3bf3b76ed161052b611a244f2c230b90a1459cef44294c7db0000000000000000000000000000000000000000000000000000000000b71b00c35aaaf9da585b778c17b66691e9664d52d43fe945660c8862f17521c4e972e2000000005cc8710905012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9be59c04489fb61a8623fe5101b2ee3ce72bc67dd007c12d7bf4fcf8ebd4c3fb1871fb6c80e91c9d463c1a261df541b2ebbbf38e7dfaf7870507305dad4e289c4b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0xe59c04489fb61a8623fe5101b2ee3ce72bc67dd007c12d7bf4fcf8ebd4c3fb18", + "receipt_root": "0x71fb6c80e91c9d463c1a261df541b2ebbbf38e7dfaf7870507305dad4e289c4b", + "gas_used": "0", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 2, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000000000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0xfd03ec0716d6c3e3bf3b76ed161052b611a244f2c230b90a1459cef44294c7db", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "3250000000000000000" + } + } + } + } + }, + { + "comment": "A holds nothing at the start of the block and pays for this transfer out of the deposit", + "expect": "success", + "block": "0x00000000000000010000000000000002cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e0053a98483398f41c27b5207f314ffd9f349ef8ec975ef8464d82bcac22eae95bca6409d4f99368df94da96d5ed0001177876f3693bf356f6a8788c3a0b107e7bfb44a30000000000000000000000000000000000000000000000000000000000b71b006c03b129319e862360d6972c74d7bf4fddc00a46fa28ef61cc6aa9c7302f2aa4000000005cc8711305012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002532ff31549454cb6e4b53810e80d1f6779f83e62a373b07197cbfca6c2ef8b1e706b999ffe2c1545e24de2251eb805fe429c8b845c5f9f452fffc66e957768b1b686e1156a64c805584793d9706ba7ba4145800fc20bd51b4da6799bb6e21b00000000000000000000000000000000000000000000000000000000000007530000000000000000000000000000000000000000000000000000000000000232800000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000010000000076f8748001825208941563915e194d8cfba1943570603f7606a31155088203e88081ff84000000018400000001828bb0828bb0801ba03f9f5691ecf617db3ef5279fe84c116176193802e10796c184bf9c6084e86302a045f7413a9c7e4d497d44a01a6a017eec82371f3621c7f5818adf16a46ce50d6b0000", + "result": { + "post_state_root": "0xe706b999ffe2c1545e24de2251eb805fe429c8b845c5f9f452fffc66e957768b", + "receipt_root": "0x1b686e1156a64c805584793d9706ba7ba4145800fc20bd51b4da6799bb6e21b0", + "gas_used": "30000", + "xshard_receive_gas_used": "9000", + "cursor": { + "root_block_height": 3, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000015000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [ + { + "success": true, + "cumulative_gas_used": 30000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 9000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0xd4f99368df94da96d5ed0001177876f3693bf356f6a8788c3a0b107e7bfb44a3", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "10000000", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000001000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "9978000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "6500000000000015000" + } + } + } + } + } + ] + }, + { + "name": "devnet_native_token_gas_real_manager", + "comment": "the real general native token manager, driven through its own interface: register QETH, propose an exchange rate of 1/30000 with a genesis-token deposit, set the refund rate to 60, then send a transaction that pays its gas in QETH at 60000 \u2014 which the contract prices at 2 (test_shard_state.py:3369)", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000", + "QETH": "10000000000" + } + }, + "514b43000000000000000000000000000000000300000001": { + "balances": {}, + "code": "0x6080604052600436106101355760003560e01c806382e1521d116100ab578063bf03314a1161006f578063bf03314a146104db578063bffa8bd0146104e3578063ce9e8c4714610514578063ceca031814610581578063dc68f0a0146105a7578063f9c94eb7146105bc57610135565b806382e1521d146103925780639447e58c146103c55780639ed2c7ef1461043a578063bb9288541461046d578063bc1fc209146104a857610135565b80635ae8f7f1116100fd5780635ae8f7f11461023f5780636d27af8c146102a8578063735e0e19146102ed578063764a27ef146103255780637e081270146103515780637e932d321461036657610135565b8063041e6c091461013a578063054f7d9c1461016357806313dee2151461017857806321a2b36e146101cc57806356e4b68b1461020e575b600080fd5b34801561014657600080fd5b5061014f6105ef565b604080519115158252519081900360200190f35b34801561016f57600080fd5b5061014f6105f8565b34801561018457600080fd5b506101ba6004803603604081101561019b57600080fd5b5080356001600160801b031690602001356001600160a01b0316610601565b60408051918252519081900360200190f35b3480156101d857600080fd5b506101ba600480360360408110156101ef57600080fd5b5080356001600160801b031690602001356001600160a01b031661061e565b34801561021a57600080fd5b5061022361063b565b604080516001600160a01b039092168252519081900360200190f35b34801561024b57600080fd5b506102846004803603606081101561026257600080fd5b506001600160801b03813581169160208101358216916040909101351661064a565b6040805167ffffffffffffffff909316835260208301919091528051918290030190f35b3480156102b457600080fd5b506102eb600480360360408110156102cb57600080fd5b5080356001600160801b0316906020013567ffffffffffffffff166108b7565b005b6102eb6004803603606081101561030357600080fd5b506001600160801b0381358116916020810135821691604090910135166109d2565b34801561033157600080fd5b506102eb6004803603602081101561034857600080fd5b50351515610e3c565b34801561035d57600080fd5b50610223610e9c565b34801561037257600080fd5b506102eb6004803603602081101561038957600080fd5b50351515610eab565b34801561039e57600080fd5b5061014f600480360360208110156103b557600080fd5b50356001600160801b0316610f0b565b3480156103d157600080fd5b506103f8600480360360208110156103e857600080fd5b50356001600160801b0316610f20565b604080516001600160a01b03909516855267ffffffffffffffff90931660208501526001600160801b0391821684840152166060830152519081900360800190f35b34801561044657600080fd5b506102eb6004803603602081101561045d57600080fd5b50356001600160801b0316610f6a565b34801561047957600080fd5b506102eb6004803603604081101561049057600080fd5b506001600160801b03813581169160200135166110a2565b3480156104b457600080fd5b506102eb600480360360208110156104cb57600080fd5b50356001600160a01b031661111f565b6102eb61118e565b3480156104ef57600080fd5b506104f86112a4565b604080516001600160801b039092168252519081900360200190f35b34801561052057600080fd5b5061054f6004803603604081101561053757600080fd5b506001600160801b03813581169160200135166112b3565b6040805167ffffffffffffffff909416845260208401929092526001600160a01b031682820152519081900360600190f35b6102eb6004803603602081101561059757600080fd5b50356001600160801b0316611401565b3480156105b357600080fd5b506104f861151a565b3480156105c857600080fd5b506102eb600480360360208110156105df57600080fd5b50356001600160801b0316611530565b60045460ff1681565b60085460ff1681565b600560209081526000928352604080842090915290825290205481565b600660209081526000928352604080842090915290825290205481565b6001546001600160a01b031681565b600854600090819060ff161561069a576040805162461bcd60e51b815260206004820152601060248201526f21b7b73a3930b1ba10333937bd32b71760811b604482015290519081900360640190fd5b6000546001600160a01b031633146106e35760405162461bcd60e51b81526004018080602001828103825260258152602001806116da6025913960400191505060405180910390fd5b60008060006106f288876112b3565b919450925090506001600160801b03878116908716810290808402908490828161071857fe5b041461076b576040805162461bcd60e51b815260206004820152601760248201527f41766f69642075696e74323536206f766572666c6f772e000000000000000000604482015290519081900360640190fd5b6001600160801b038a1660009081526005602090815260408083206001600160a01b03871684529091529020548111156107d65760405162461bcd60e51b81526004018080602001828103825260238152602001806117726023913960400191505060405180910390fd5b6001600160801b038a1660009081526006602090815260408083206001600160a01b03871684529091529020548281019081101561085b576040805162461bcd60e51b815260206004820152601860248201527f41766f6964206164646974696f6e206f766572666c6f772e0000000000000000604482015290519081900360640190fd5b6001600160801b038b1660008181526005602090815260408083206001600160a01b0390981680845297825280832080549690960390955591815260068252838120958152949052922091909155509092509050935093915050565b6001600160801b0382166000908152600260205260409020546001600160a01b0316331461092c576040805162461bcd60e51b815260206004820152601f60248201527f4f6e6c792061646d696e2063616e2073657420726566756e6420726174652e00604482015290519081900360640190fd5b8067ffffffffffffffff16600a11158015610952575060648167ffffffffffffffff1611155b61098d5760405162461bcd60e51b815260040180806020018281038252602f8152602001806117cc602f913960400191505060405180910390fd5b6001600160801b039091166000908152600260205260409020805467ffffffffffffffff909216600160a01b0267ffffffffffffffff60a01b19909216919091179055565b60085460ff1615610a1d576040805162461bcd60e51b815260206004820152601060248201526f21b7b73a3930b1ba10333937bd32b71760811b604482015290519081900360640190fd5b60045460ff1615610a95576001600160801b03831660009081526007602052604090205460ff16610a95576040805162461bcd60e51b815260206004820152601860248201527f546f6b656e20494420646f6573206e6f742065786973742e0000000000000000604482015290519081900360640190fd5b6743a3163a81075073836001600160801b03161115610af3576040805162461bcd60e51b815260206004820152601560248201527426b0bc103a37b5b2b71024a2103932b0b1b432b21760591b604482015290519081900360640190fd5b826001600160801b0316618bb01415610b4c576040805162461bcd60e51b815260206004820152601660248201527521b0b713ba103132903232b330bab63a103a37b5b2b760511b604482015290519081900360640190fd5b816001600160801b0316600010610ba6576040805162461bcd60e51b81526020600482015260196024820152782b30b63ab29039b437bab632103132903737b716bd32b9379760391b604482015290519081900360640190fd5b806001600160801b0316600010610c00576040805162461bcd60e51b81526020600482015260196024820152782b30b63ab29039b437bab632103132903737b716bd32b9379760391b604482015290519081900360640190fd5b6003546001600160801b03908116818316026152089184169190910210610c585760405162461bcd60e51b81526004018080602001828103825260378152602001806117956037913960400191505060405180910390fd5b6003546001600160801b038481166000908152600560209081526040808320338452909152902054600160801b90920416349091011015610cca5760405162461bcd60e51b81526004018080602001828103825260308152602001806117426030913960400191505060405180910390fd5b6001600160801b0380841660009081526002602090815260408083206005835281842060035482546001600160a01b031686529381905291909320549293909291161180610d3757506001820154610d37906001600160801b0380821691600160801b90041686866115d7565b610d725760405162461bcd60e51b81526004018080602001828103825260238152602001806116946023913960400191505060405180910390fd5b336000908152602082905260409020543490810190811015610dd0576040805162461bcd60e51b815260206004820152601260248201527120b23234ba34b7b71037bb32b9333637bb9760711b604482015290519081900360640190fd5b33600081815260209390935260409092205581546001830180546001600160801b0319166001600160801b03968716178616600160801b9590961694909402949094179092556001600160a01b03199092161767ffffffffffffffff60a01b1916601960a11b17905550565b6001546001600160a01b03163314610e89576040805162461bcd60e51b815260206004820152601b60248201526000805160206116ff833981519152604482015290519081900360640190fd5b6004805460ff1916911515919091179055565b6000546001600160a01b031681565b6001546001600160a01b03163314610ef8576040805162461bcd60e51b815260206004820152601b60248201526000805160206116ff833981519152604482015290519081900360640190fd5b6008805460ff1916911515919091179055565b60076020526000908152604090205460ff1681565b600260205260009081526040902080546001909101546001600160a01b03821691600160a01b900467ffffffffffffffff16906001600160801b0380821691600160801b90041684565b60085460ff1680610f9c57506001600160801b0381166000908152600260205260409020546001600160a01b03163314155b610fd75760405162461bcd60e51b815260040180806020018281038252602381526020018061171f6023913960400191505060405180910390fd5b6001600160801b03811660009081526005602090815260408083203384529091529020548061104d576040805162461bcd60e51b815260206004820152601b60248201527f53686f756c642068617665206e6f6e2d7a65726f2076616c75652e0000000000604482015290519081900360640190fd5b6001600160801b038216600090815260056020908152604080832033808552925280832083905551909183156108fc02918491818181858888f1935050505015801561109d573d6000803e3d6000fd5b505050565b6001546001600160a01b031633146110ef576040805162461bcd60e51b815260206004820152601b60248201526000805160206116ff833981519152604482015290519081900360640190fd5b600380546001600160801b03928316600160801b029383166001600160801b031990911617909116919091179055565b6001546001600160a01b0316331461116c576040805162461bcd60e51b815260206004820152601b60248201526000805160206116ff833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b611196611630565b6020816000808064514b430001600019f16111b057600080fd5b8051618bb06001600160801b03821614156111fc5760405162461bcd60e51b81526004018080602001828103825260238152602001806116b76023913960400191505060405180910390fd5b6001600160801b03811660009081526007602052604090205460ff161561126a576040805162461bcd60e51b815260206004820152601960248201527f546f6b656e20616c726561647920726567697374657265642e00000000000000604482015290519081900360640190fd5b6001600160801b03166000908152600760209081526040808320805460ff1916600117905560068252808320338452909152902034905550565b6003546001600160801b031681565b60008060006112c061164e565b506001600160801b03858116600090815260026020908152604091829020825160808101845281546001600160a01b038116808352600160a01b90910467ffffffffffffffff169382019390935260019091015480851693820193909352600160801b909204909216606082015290611371576040805162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b2103a37b5b2b71760911b604482015290519081900360640190fd5b604081015160608201516001600160801b03918216828816029116818161139457fe5b049050600081116113ec576040805162461bcd60e51b815260206004820152601b60248201527f53686f756c642068617665206e6f6e2d7a65726f2076616c75652e0000000000604482015290519081900360640190fd5b60208201519151919450925090509250925092565b6001600160801b0381166000908152600560209081526040808320338452909152902054611476576040805162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520616e206578697374656420746f6b656e000000000000604482015290519081900360640190fd5b6001600160801b038116600090815260056020908152604080832033845290915290205434908101908110156114f3576040805162461bcd60e51b815260206004820152601960248201527f52657365727665642062616c616e6365206f766572666c6f7700000000000000604482015290519081900360640190fd5b6001600160801b039091166000908152600560209081526040808320338452909152902055565b600354600160801b90046001600160801b031681565b6001600160801b0381166000908152600660209081526040808320338452909152902054806115a6576040805162461bcd60e51b815260206004820152601b60248201527f53686f756c642068617665206e6f6e2d7a65726f2076616c75652e0000000000604482015290519081900360640190fd5b6001600160801b038216600081815260066020908152604080832033808552925282209190915561109d91836115f3565b6001600160801b03918216928216929092029281169116021090565b60006115fd611675565b84815260208082018590526040820184905282606083600064514b430002600019f161162857600080fd5b509392505050565b60405180602001604052806001906020820280388339509192915050565b60408051608081018252600080825260208201819052918101829052606081019190915290565b6040518060600160405280600390602082028038833950919291505056fe496e76616c6964206e65772065786368616e676520726174652070726f706f73616c2e44656661756c7420746f6b656e2063616e6e6f7420626520726567697374657265642e4f6e6c792063616c6c65722063616e20696e766f6b6520746869732066756e6374696f6e2e4f6e6c792073757065727669736f7220697320616c6c6f7765642e00000000004e6f7420616c6c6f77656420666f72206e617469766520746f6b656e2061646d696e2e53686f756c642068617665207265736572766520616d6f756e742067726561746572207468616e206d696e696d756d2e53686f756c64206861766520656e6f75676820726573657276657320746f207061792e52657175697265732065786368616e67652072617465202a203231303030203c206d696e476173526573657276654d61696e7461696e2e526566756e642070657274656e746167652073686f756c64206265206265747765656e20313020616e64203130302ea265627a7a72315820923fb9d8c38c521f16b3886f1bc6ca4175913f9387285f6fbcafb779b40bf55764736f6c63430005110032000000000000000000000000c4fba3740f95d25b2196c9437fdb005359296d36", + "storage": { + "0x00": "0x000000000000000000000000514b430000000000000000000000000000000003", + "0x01": "0x00000000000000000000000019e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "0x03": "0x0000000000000000000000000000000000000000000000000000000000007530", + "0x04": "0x0000000000000000000000000000000000000000000000000000000000000001" + } + } + }, + "genesis": { + "state_root": "0xd167156bd33ac1e8cb5157be1d1b1c86fcbd70b2d7ddd5063ba3a4d2e47d35c9", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b0032fcac819658b955e25755d02aee0f0994be306b16355ba8c1c4c0e1ca7a29ab000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d167156bd33ac1e8cb5157be1d1b1c86fcbd70b2d7ddd5063ba3a4d2e47d35c900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [], + "blocks": [ + { + "comment": "the three admin calls, in the order the contract requires: nothing can be proposed for an unregistered token", + "expect": "success", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e005000024a411f968738196984c44881f21d1b8dbba6b31540f953bfaed9ff87512bc2a5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b001647e58ffe5c148c4fa749bbaafce4103a096cb13d2f6aa23e83fa6ed345f821000000005cc8710905012a05f2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000093dcb224212ca94fac7dd697a2ff0d4e8f2fbedfc05ec87ce87cfe06ff2b7b451f2a78ae3a98425802cb2a8061171d1224203bd4c5aeae7d35b40a1b9074d1e071347efdb0a17d5c4873d6c99bffc6f43c075c10d3587923195391306a1e8cbc000000000000000000000000000000000000000000000000000000000002b31a000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d8000000003000000007af8788080830f424094514b4300000000000000000000000000000000030184bf03314a81ff84000000018400000001828bb0831388f9801ca0a511ffb29419ee4247f69060df3ad0990fca1658f621b1c5cfa8ec0146ee63c4a02683439d3be3a60934d45965b0d05e31e4cc325f8c5820e6f181e4fe0a17813100000000ddf8db0180830f424094514b430000000000000000000000000000000003830186a0b864735e0e1900000000000000000000000000000000000000000000000000000000001388f90000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000753081ff84000000018400000001828bb0828bb0801ca0a5e7b2989094fb8a230e740666e38f4f6ef8766886e79f6d18f1c7d867f565e2a05a70cae9adaef389533a54a8b572946b277907c4827bd0e1431ee5eca45fc52400000000baf8b80280830f424094514b43000000000000000000000000000000000380b8446d27af8c00000000000000000000000000000000000000000000000000000000001388f9000000000000000000000000000000000000000000000000000000000000003c81ff84000000018400000001828bb0828bb0801ba0641e3b94a9ca5f0c672edbadee863905b335862724bf9e0aa06260c0d7ce0035a02ab312d6fcf0861ccf0cc8f0405f470b83e1f7d4f22fde17ccca27abc83dffb00000", + "result": { + "post_state_root": "0x1f2a78ae3a98425802cb2a8061171d1224203bd4c5aeae7d35b40a1b9074d1e0", + "receipt_root": "0x71347efdb0a17d5c4873d6c99bffc6f43c075c10d3587923195391306a1e8cbc", + "gas_used": "176922", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 1, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000000000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [ + { + "success": true, + "cumulative_gas_used": 63061, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 149111, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 176922, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 3, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999900000", + "1280249": "9999999999" + } + }, + "514b430000000000000000000000000000000003": { + "nonce": 1, + "code_hash": "0x7f740442eb19cc2b6422ebdf6b00055aa397485b114aa435992fd8515d53d840", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "100000", + "1280249": "1" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "3250000000000000000" + } + } + } + } + }, + { + "comment": "gas paid in QETH, priced by the contract: 60000 QETH per gas becomes 2 QKC per gas, and 60% of the unused gas comes back", + "expect": "success", + "block": "0x00000000000000010000000000000002cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e00552087c79d535e0125a69639cfa755693b0706997ec0990e1265412ee38d57d1c9a7a5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b007815320365fcb8165349294beb73cf0debde23fe55c6375aa7bffa805b110bf8000000005cc8711305012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000194ba48fefe207d1e2f17d00d05c20d7ab74a9c61876b44bd98225b057ee6d1f5e41677a0bb8271f1559740c7a6c561e6b8375dbe580a7733b0414271a2c801888a4616ba0f1d6ffa676c8fd835514dac598d2bd25922b3e21c68763788e29b70000000000000000000000000000000000000000000000000000000000005208000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d8000000001000000007af8780382ea60827530941563915e194d8cfba1943570603f7606a31155088230398081ff84000000018400000001831388f9831388f9801ca067ee8c093ae8c44862000397c91456b5b5e045f39da8c1b49f740795de69bfc0a05738134f9500e4b7e7f544739446ccc7022dd5938a26685b1fa18e0e0e1ee7680000", + "result": { + "post_state_root": "0x5e41677a0bb8271f1559740c7a6c561e6b8375dbe580a7733b0414271a2c8018", + "receipt_root": "0x88a4616ba0f1d6ffa676c8fd835514dac598d2bd25922b3e21c68763788e29b7", + "gas_used": "21000", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 1, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000021000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "produced_deposits": [], + "consumed_deposits": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "1280249": "12345" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 4, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999910800", + "1280249": "8199987654" + } + }, + "514b430000000000000000000000000000000003": { + "nonce": 1, + "code_hash": "0x7f740442eb19cc2b6422ebdf6b00055aa397485b114aa435992fd8515d53d840", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "40000", + "1280249": "1800000001" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "6500000000000021000" + } + } + } + } + } + ] + }, + { + "name": "devnet_native_token_gas_block", + "comment": "a whole block whose transaction pays gas in QETH: the manager's sale, the refund at the rate it named and the burn of the remainder all land in the block's state root, while the coinbase map stays in the genesis token", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QETH": "10000000" + } + }, + "514b43000000000000000000000000000000000300000001": { + "balances": { + "QKC": "1000000000000000000" + }, + "code": "0x6050600052600260205260406000f3" + } + }, + "genesis": { + "state_root": "0x5b3b5f6c6acaaa88de15570d92d44af53263965945031156ecc973465fd4e7a7", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b00d26f8c2345bdfc8e415d613af94cb10c928456f71736d87a71fc857d659d684d000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b3b5f6c6acaaa88de15570d92d44af53263965945031156ecc973465fd4e7a700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [], + "blocks": [ + { + "comment": "", + "expect": "success", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e00552083b0741c5fbccac87e66322c0e9a7c54af07a61dd769de4e8e4ea905fcafe21835ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b00617ce8411e3c4516036c6611dc032a55153cdc774ea4820e1f1588decfd53713000000005cc8710905012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000df444beda5235906a48898e916e0cf44195e134314f4a679521d34b070010f70993949ee69b2359bca46c2a3b8bea65b85266c49ce4fc869194e12e4b7f7e8d4ac128a85e52d212792962e3cb631d175cd9bb92da40154e1c28d955a300f32370000000000000000000000000000000000000000000000000000000000005208000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000010000000078f8768003827530941563915e194d8cfba1943570603f7606a31155088230398081ff84000000018400000001831388f9831388f9801ba0d29209578282e07c3bac34e19d5300f039236d70073d5431f6024184cc3c2dada046b8d185f907415c51f61cd0f725aa67d83d88b579224863a9e4b918ea8756e10000", + "result": { + "post_state_root": "0x993949ee69b2359bca46c2a3b8bea65b85266c49ce4fc869194e12e4b7f7e8d4", + "receipt_root": "0xac128a85e52d212792962e3cb631d175cd9bb92da40154e1c28d955a300f3237", + "gas_used": "21000", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 1, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000021000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "1280249": "12345" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "14400", + "1280249": "9897655" + } + }, + "514b430000000000000000000000000000000003": { + "nonce": 1, + "code_hash": "0xb8596d7365c5c8d9b5177129efadab4489b96afcd13775c52fc304bd31396262", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999940000", + "1280249": "90000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "3250000000000021000" + } + } + } + } + } + ] + }, + { + "name": "devnet_selfdestruct_coinbase_resurrected_by_reward", + "comment": "SELFDESTRUCT does not delete the account: del_account strips it once the message is over (messages.py:351), and the end-of-block sweep decides whether the leaf survives. Here the stripped account is the block's own coinbase, so the reward paid at the end of run_block brings it back \u2014 Ethereum's unconditional delete would drop it together with the reward", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "5000" + }, + "code": "0x73bbbb0000000000000000000000000000000000bbff" + } + }, + "genesis": { + "state_root": "0xa41fea6542d46c72fa41615f2fde12b1908b5279694ded68e03d2d2338d3d9bf", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b00a13d94bbd0b3c27011d263e5bbb6f0010e09ec6147cda2e72b778bd0749fc053000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a41fea6542d46c72fa41615f2fde12b1908b5279694ded68e03d2d2338d3d9bf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [], + "blocks": [ + { + "comment": "", + "expect": "success", + "block": "0x00000000000000010000000000000001aaaa0000000000000000000000000000000000aa0000000100000001028bb0082d1a51c7e00534bd490ecd2c26f3f2c207ba3c76b92a9a39d1962cf932c50ffe0ba1b2002fcd95665ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b00b7286b325cadacb08ae5001f60267a83527074a8fa6b91646b80100856091dd8000000005cc8710905012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009c549aaad6657831f6f5dda16cb0d633e63ba0ef9bd9019ee525798215ac40b6864d4864cf872c7efbf1fc20312ef653829a59c051b1fff1ea9d2ec3ac75b4a1c6bf5c86f5980de4489b222bebf58f4a2b547412b4e4bad8d71ed01c2e805dfb000000000000000000000000000000000000000000000000000000000000697b000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000010000000075f873800183030d4094aaaa0000000000000000000000000000000000aa808081ff84000000018400000001828bb0828bb0801ba01c27d0bcdcdd855b5bcb6ef7815947d9d42bc06cac7fbe7e785d859d130c123ba02fd56ad87158cf955359240f8f3b76b50bfad5e3fc8d6c71b4cc38c225422f980000", + "result": { + "post_state_root": "0x864d4864cf872c7efbf1fc20312ef653829a59c051b1fff1ea9d2ec3ac75b4a1", + "receipt_root": "0xc6bf5c86f5980de4489b222bebf58f4a2b547412b4e4bad8d71ed01c2e805dfb", + "gas_used": "27003", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 1, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000013501" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [ + { + "success": true, + "cumulative_gas_used": 27003, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999972997" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "3250000000000000000" + } + } + } + } + } + ] + }, + { + "name": "devnet_selfdestruct_then_paid_again", + "comment": "the same rule inside one block: the account is stripped by the transaction that destroys it and brought back by the next transaction that pays it", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "5000" + }, + "code": "0x73bbbb0000000000000000000000000000000000bbff" + } + }, + "genesis": { + "state_root": "0xa41fea6542d46c72fa41615f2fde12b1908b5279694ded68e03d2d2338d3d9bf", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b00a13d94bbd0b3c27011d263e5bbb6f0010e09ec6147cda2e72b778bd0749fc053000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a41fea6542d46c72fa41615f2fde12b1908b5279694ded68e03d2d2338d3d9bf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [], + "blocks": [ + { + "comment": "", + "expect": "success", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e0055dc1490ecd2c26f3f2c207ba3c76b92a9a39d1962cf932c50ffe0ba1b2002fcd95665ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b00caca6ace1b28f3b9ebf93611d9838b65063fa7334949d0d4aaeb6d86fedc6021000000005cc8710905012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009650e95af647a57c25dd339c13c828879587a2c3770adaf6d54dd043346cc63c4eacb9a1f9c3b7751ef731b8d08761b8b7e2335384ab8934d34781415b6e8d2463f7f800589115922b36dbb5e0d42e32cf795240594f4466c8557d15abc284b1000000000000000000000000000000000000000000000000000000000000bb83000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000020000000075f873800183030d4094aaaa0000000000000000000000000000000000aa808081ff84000000018400000001828bb0828bb0801ba01c27d0bcdcdd855b5bcb6ef7815947d9d42bc06cac7fbe7e785d859d130c123ba02fd56ad87158cf955359240f8f3b76b50bfad5e3fc8d6c71b4cc38c225422f980000000077f875010183030d4094aaaa0000000000000000000000000000000000aa8203098081ff84000000018400000001828bb0828bb0801ba08aac0ecdd0aaf664284db654e30bfd7f443e2dc66fca22de18d47a048c0d7ceaa0461037d3c8c73fb6ce3ce3308faad0fa2f6d46c8745270f015b4d8c69c97dde50000", + "result": { + "post_state_root": "0x4eacb9a1f9c3b7751ef731b8d08761b8b7e2335384ab8934d34781415b6e8d24", + "receipt_root": "0x63f7f800589115922b36dbb5e0d42e32cf795240594f4466c8557d15abc284b1", + "gas_used": "48003", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 1, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000024001" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [ + { + "success": true, + "cumulative_gas_used": 27003, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 48003, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 2, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999951220" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "777" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "3250000000000024001" + } + } + } + } + } + ] + }, + { + "name": "devnet_block_rejected_bad_nonce", + "comment": "a block carrying a transaction whose nonce is far ahead is refused whole: run_block re-validates every transaction and raises on the first failure, so nothing the block did is published", + "network": "devnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "1563915e194d8cfba1943570603f7606a311550800000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "genesis": { + "state_root": "0x20dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000005ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff030186a0030186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [], + "blocks": [ + { + "comment": "", + "expect": "rejected", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc00000001000000003fde4f62fa737a7e25d8473639630ee533cc353800eef4a02141609d1a9592bf5ad443efb7cf5246a3d1bbc1734bd02bf3a5d83bedeccfcfe707d0ebee03780d0000000000000000000000000000000000000000000000000000000000b71b000000000000000000000000000000000000000000000000000000000000000000000000005cc8710905012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000010000000076f8746301825208941563915e194d8cfba1943570603f7606a31155088203e88081ff84000000018400000001828bb0828bb0801ba0ef315b067fce274a4f8f38cf66256c1a978ac45b124ba4e742bdbc3a55049280a06fe85e65757cc0c80d51060c7d71832aba2da8d822d1b96ff23e663baf6752b70000", + "result": { + "rejected": true, + "error_type": "InvalidNonce", + "error": ": 'nonce' actual:99 target:0" + } + } + ] + }, + { + "name": "mainnet_xshard_across_evm_switch", + "comment": "the same deposit shape on both sides of ENABLE_EVM_TIMESTAMP: before it the value is handed straight to the recipient with no receipt, at it the deposit runs as an EVM message and produces one (shard_state.py:1591, messages.py:368)", + "network": "mainnet", + "full_shard_id": 1, + "genesis_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "1563915e194d8cfba1943570603f7606a311550800000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "genesis": { + "state_root": "0x20dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f", + "block": "0x0000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000004036783e441eb5057bf2be96bf1fd4585ac49824de15c0d92a4c14a97886ca510000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020dc1dca2422eeb3f92fad0e83f4d99032c04d6a6eb4fe6332a0c59742d7352f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000" + }, + "root_blocks": [ + { + "height": 0, + "hash": "0x4036783e441eb5057bf2be96bf1fd4585ac49824de15c0d92a4c14a97886ca51", + "block": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005cc870ff0609184e72a0000609184e72a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 1, + "hash": "0xc1b986032aba42538080dbd89fa9c27aa1ae0c071a55cb32c3c8f8b2a4b65b94", + "block": "0x00000000000000014036783e441eb5057bf2be96bf1fd4585ac49824de15c0d92a4c14a97886ca5184cbc68130e5342f3cc9df6ca42b2e2531c19421a20d90b8e9bdced7d5411a9256e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42100000000000000000000000000000000000000000000000000000000000000005cc871000609184e72a0000612309ce540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000000000000000000000000000100000001028bb0082d1a51c7e005000000000000000000000000000000000000000000000000000000000000000000004036783e441eb5057bf2be96bf1fd4585ac49824de15c0d92a4c14a97886ca510000000000000000000000000000000000000000000000000000000000b71b000fd3990a19fd2f8129fba76f4d8252a98c6a4f6f8f1ce1324136a321ef10f06c000000005cc870ff05012a05f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a497420776173207468652062657374206f662074696d65732c206974207761732074686520776f727374206f662074696d65732c202e2e2e202d20436861726c6573204469636b656e7300000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 2, + "hash": "0x869fd2884c609a7d0b6f3fd1286cdf9c1c06daf35871fb8d23e2f9ecabf4e882", + "block": "0x0000000000000002c1b986032aba42538080dbd89fa9c27aa1ae0c071a55cb32c3c8f8b2a4b65b94b556dc8f7640f2e95d93faf0916c658409c9281fe16b5e545acb17b90842941a56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42100000000000000000000000000000000000000000000000000000000000000005cc871010609184e72a000061b48eb57e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000100010000000000000001000000000000000000000000000000000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000c1b986032aba42538080dbd89fa9c27aa1ae0c071a55cb32c3c8f8b2a4b65b940000000000000000000000000000000000000000000000000000000000b71b00000000000000000000000000000000000000000000000000000000000000000000000000000000010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "height": 3, + "hash": "0xf2a15f3ce5353f1b02415457a221c0d9382810b4fca4dc1a62feb92e06104f32", + "block": "0x0000000000000003869fd2884c609a7d0b6f3fd1286cdf9c1c06daf35871fb8d23e2f9ecabf4e8823a4dbea71ebc10e3aa8bdf6fc81174e9e7bad792a022cd24c3c819d14ae3c33856e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42100000000000000000000000000000000000000000000000000000000000000005cc871020609184e72a00006246139ca800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000100010000000000000002000000000000000000000000000000000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000869fd2884c609a7d0b6f3fd1286cdf9c1c06daf35871fb8d23e2f9ecabf4e8820000000000000000000000000000000000000000000000000000000000b71b00000000000000000000000000000000000000000000000000000000000000000000000000000000010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "xshard_lists": [ + { + "minor_block_hash": "0x980e1856ded97a19d4c33bd42a0d19f7f9dedf6cbbe89b517cac074372c53ad5", + "full_shard_id": 65537, + "deposits": [ + { + "tx_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "500", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ] + }, + { + "minor_block_hash": "0xbbbbec793533a4a5badccfc75b903b19d8b372ab4bee3ec3d57c3b0493448f98", + "full_shard_id": 65537, + "deposits": [ + { + "tx_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "500", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ] + } + ], + "blocks": [ + { + "comment": "", + "expect": "success", + "block": "0x00000000000000010000000000000001cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e005000039a6b91969d62ae4b83fd8c38d76feb629514b6e01458adf4fd1a4d0dd290832c1b986032aba42538080dbd89fa9c27aa1ae0c071a55cb32c3c8f8b2a4b65b940000000000000000000000000000000000000000000000000000000000b71b00116a2c51cb9e81a2fcd44f38ea45665524795ea7999f45965c03947334313e3d000000005d8db36605012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9bf36b6b6af6b75ce778225a6de048a0b9e0f3fa6ea7aed2e14ce7199b49207e4f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0xf36b6b6af6b75ce778225a6de048a0b9e0f3fa6ea7aed2e14ce7199b49207e4f", + "receipt_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "gas_used": "0", + "xshard_receive_gas_used": "0", + "cursor": { + "root_block_height": 2, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000000000" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x4036783e441eb5057bf2be96bf1fd4585ac49824de15c0d92a4c14a97886ca51", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0xc1b986032aba42538080dbd89fa9c27aa1ae0c071a55cb32c3c8f8b2a4b65b94", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "3250000000000000000" + } + } + } + } + }, + { + "comment": "pre-EVM: one second before the switch", + "expect": "success", + "block": "0x00000000000000010000000000000002cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e005119441a81519d6009adcf030c0eebc9bbaa46a6c07db1393fd0672d81231e2bbb3b1869fd2884c609a7d0b6f3fd1286cdf9c1c06daf35871fb8d23e2f9ecabf4e8820000000000000000000000000000000000000000000000000000000000b71b0067c44c8cd21c6882428b34649e4c9cd02952d856af99f57b98ffb690fa201178000000005d8db36f05012a05f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9be9a61205622ab93b261c5e54e222d2d75e579a89bc63f66f9809c8f282f27a3856e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4210000000000000000000000000000000000000000000000000000000000002328000000000000000000000000000000000000000000000000000000000000232800000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0xe9a61205622ab93b261c5e54e222d2d75e579a89bc63f66f9809c8f282f27a38", + "receipt_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "gas_used": "9000", + "xshard_receive_gas_used": "9000", + "cursor": { + "root_block_height": 3, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000004500" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0x869fd2884c609a7d0b6f3fd1286cdf9c1c06daf35871fb8d23e2f9ecabf4e882", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "500", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000500" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "6500000000000004500" + } + } + } + } + }, + { + "comment": "post-EVM: the switch is a >= on the block timestamp", + "expect": "success", + "block": "0x00000000000000010000000000000003cccc0000000000000000000000000000000000cc0000000100000001028bb0082d1a51c7e0051194574398eecbb40bd677e3c7cb157054b1a4b5f8d7db04429fd8c9d635e77dd1c2f2a15f3ce5353f1b02415457a221c0d9382810b4fca4dc1a62feb92e06104f320000000000000000000000000000000000000000000000000000000000b71b00c7a9280e56dc253e4b7ab63c2bad0bdc3c900c0ca5940480799af7ea07c7d09a000000005d8db37005012a9af4f900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000daa77426c30c02a43d9fba4e841a6556c524d47030762eb14dc4af897e605d9b2e0913e88d74918fd1b996df7a0fd59d72a89fa5aefa5c2b570467e4d5ca1b47a855176b0a068223b513d11cbdef93a8d2fbeec0e7a353e8fe8a3479588356fb0000000000000000000000000000000000000000000000000000000000002328000000000000000000000000000000000000000000000000000000000000232800000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8d80000000000000", + "result": { + "post_state_root": "0x2e0913e88d74918fd1b996df7a0fd59d72a89fa5aefa5c2b570467e4d5ca1b47", + "receipt_root": "0xa855176b0a068223b513d11cbdef93a8d2fbeec0e7a353e8fe8a3479588356fb", + "gas_used": "9000", + "xshard_receive_gas_used": "9000", + "cursor": { + "root_block_height": 4, + "minor_block_index": 0, + "xshard_deposit_index": 0 + }, + "coinbase_amount_map": { + "35760": "3250000000000004500" + }, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 0, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + }, + { + "success": true, + "cumulative_gas_used": 9000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "produced_deposits": [], + "consumed_deposits": [ + { + "tx_hash": "0xf2a15f3ce5353f1b02415457a221c0d9382810b4fca4dc1a62feb92e06104f32", + "from": "0x0000000000000000000000000000000000000000", + "from_full_shard_key": 0, + "to": "0x0000000000000000000000000000000000000000", + "to_full_shard_key": 0, + "value": "0", + "gas_price": "0", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": true, + "refund_rate": 100 + }, + { + "tx_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", + "from": "0x1563915e194d8cfba1943570603f7606a3115508", + "from_full_shard_key": 65537, + "to": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "to_full_shard_key": 1, + "value": "500", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000001000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "9750000000000009000" + } + } + } + } + } + ] + } + ] +} diff --git a/qkc/testdata/exec_golden/message_level.json b/qkc/testdata/exec_golden/message_level.json new file mode 100644 index 00000000000..5bea6196b41 --- /dev/null +++ b/qkc/testdata/exec_golden/message_level.json @@ -0,0 +1,4031 @@ +{ + "_comment": [ + "Single transactions and cross-shard deposits driven through", + "apply_transaction / apply_xshard_deposit, generated by", + "qkc/testdata/gen_exec_golden.py against pyquarkchain. Each case", + "declares whether it pins a successful execution or a rejection." + ], + "source": { + "pyquarkchain_commit": "75f8d7e166df0f5a2579ffe37ea7b4f5ba79db60", + "dirty_modules": [], + "module_digests": { + "quarkchain/evm/messages.py": "7d6cb97202b0e5e7", + "quarkchain/evm/state.py": "de5216e6c10e606e", + "quarkchain/evm/transactions.py": "573f578989e912a1", + "quarkchain/evm/specials.py": "c14638312c952401", + "quarkchain/evm/opcodes.py": "40d1eaab9bb6612a", + "quarkchain/cluster/shard_state.py": "9cc7a3ff57b383b5", + "quarkchain/core.py": "3f6d1865eb449b80", + "quarkchain/genesis.py": "15d80022b9b6aa0b", + "quarkchain/config.py": "cda1b5ca536bb8af", + "quarkchain/utils.py": "33ec76129f0d8269" + } + }, + "cases": [ + { + "name": "in_shard_transfer", + "comment": "plain in-shard QKC transfer: nonce increments before gas is bought, fee lands in the coinbase and in block_fee_tokens", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1000000000", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "100", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "92629754593885224637707096067328567470999390835941728541663727102761541629835", + "s": "47642284724237099574389529017364847995245119895002039022396934744488806066286", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x3c57b5cf74b57e4c577827b1df5b253622b49f211ef029e85c7cf56d2be71bce" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x35b9f89979e1b9655da88a9dd037a88159041b7c52a7191a94e8f1b39129f91c", + "gas_used": 21000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "10500000000000" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "100" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999978999999999900" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "10500000000000" + } + } + } + }, + { + "name": "in_shard_transfer_nonce_too_high", + "comment": "apply_transaction re-validates, so a future nonce is rejected and nothing is written", + "network": "devnet", + "full_shard_id": 1, + "expect": "rejected", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 5, + "gas_price": "1000000000", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "100", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "43452780468224075210258465753090621260029673539922845965597445710117028755618", + "s": "5350194407648994926907370230156765043077789988104190620405581695094675033995", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x9f9c05b23ec2cb0f6501acac710ea184d4ca58dd57c58f30ac7b3985bc123cb8" + } + } + ], + "gas_used_start": 0, + "result": { + "rejected": true, + "error_type": "InvalidNonce", + "error": ": 'nonce' actual:5 target:0" + }, + "post_state_root": "0x10a4104584d3cf2cbfc5cd66284fbffd41296e9d21e14d311e8a456a6c6f5b61", + "gas_used": 0, + "xshard_receive_gas_used": 0, + "block_fee_tokens": {}, + "receipts": [], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "in_shard_transfer_insufficient_balance", + "comment": "the balance check covers value plus the whole gas budget", + "network": "devnet", + "full_shard_id": 1, + "expect": "rejected", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "21000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "100", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "105235691627345466476390482546247020838971554462214381630990955951945747611602", + "s": "25604808059286412993729285105354776390966599994382420754840728410204905138680", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x4f3896bfc08f671963ca77d60e3108af8dc7c9caac66b0f9b23a9cbf169767a0" + } + } + ], + "gas_used_start": 0, + "result": { + "rejected": true, + "error_type": "InsufficientBalance", + "error": ": 'token QKC balance' actual:21000 target:30100" + }, + "post_state_root": "0x658451b6fde330fb032c58c65b764a6280c644ffc3f3b63d38d4d58336250de7", + "gas_used": 0, + "xshard_receive_gas_used": 0, + "block_fee_tokens": {}, + "receipts": [], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "21000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "xshard_deposit_to_empty_account", + "comment": "post-EVM deposit: the value is credited to the sender on this shard first, then moved by an EVM message (messages.py:368-377)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": {}, + "inputs": [ + { + "kind": "deposit", + "deposit": { + "tx_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "from": "0xaaaa0000000000000000000000000000000000aa", + "from_full_shard_key": 1, + "to": "0xbbbb0000000000000000000000000000000000bb", + "to_full_shard_key": 1, + "value": "1000", + "gas_price": "1000000000", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "0", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + } + ], + "gas_used_start": 9000, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x81d2367248460ebfacb3888553b8a24c9003af657f02295f876ff98c269e74de", + "gas_used": 9000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "4500000000000" + }, + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": true, + "cumulative_gas_used": 9000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_list": [], + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "4500000000000" + } + } + } + }, + { + "name": "native_token_transfer_with_default_gas", + "comment": "a foreign transfer token with the chain's own token for gas: no conversion, the fee stays in QKC and only the transfer moves QETH", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000", + "QETH": "99999" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1000000000", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "12345", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 1280249, + "version": 0, + "v": "28", + "r": "38931626654540861761290020752395893272033295372665167240312559784773803426545", + "s": "42349118438586247932045343331965777134898294351646641048824619484789983463086", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x0cf89122484ec3611aa0e73c585b638e87a22da754b7a2f53e4a25cce63799f8" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x3edec6e5107b9a8d2f450638d1c01bd16ffb4b3ee687e0b327fe0924784d58a9", + "gas_used": 21000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "10500000000000" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "1280249": "12345" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999979000000000000", + "1280249": "87654" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "10500000000000" + } + } + } + }, + { + "name": "native_token_transfer_sender_holds_none", + "comment": "validate_transaction (4): a token the sender holds none of is refused outright, where the chain's own token is spendable from empty", + "network": "devnet", + "full_shard_id": 1, + "expect": "rejected", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1000000000", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "12345", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 1280249, + "version": 0, + "v": "28", + "r": "38931626654540861761290020752395893272033295372665167240312559784773803426545", + "s": "42349118438586247932045343331965777134898294351646641048824619484789983463086", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x0cf89122484ec3611aa0e73c585b638e87a22da754b7a2f53e4a25cce63799f8" + } + } + ], + "gas_used_start": 0, + "result": { + "rejected": true, + "error_type": "InvalidNativeToken", + "error": ": non-default token QETH has zero balance" + }, + "post_state_root": "0x10a4104584d3cf2cbfc5cd66284fbffd41296e9d21e14d311e8a456a6c6f5b61", + "gas_used": 0, + "xshard_receive_gas_used": 0, + "block_fee_tokens": {}, + "receipts": [], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "native_token_as_gas_converted", + "comment": "gas paid in QETH: the manager is asked for a price, sells the genesis token that funds the frame and keeps the QETH, and the unused gas comes back at the rate it named \u2014 80%, with the other 20% burned to the zero address (messages.py:438-460, 268)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QETH": "10000000" + } + }, + "514b43000000000000000000000000000000000300000001": { + "balances": { + "QKC": "1000000000000000000" + }, + "code": "0x6050600052600260205260406000f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "3", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "12345", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 1280249, + "transfer_token_id": 1280249, + "version": 0, + "v": "27", + "r": "95243722348920504376668056695637889321155105003743482657399656598087485107629", + "s": "31988445337633001150564659717785962518963813406747053133043569680890181670625", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x1857622d120320262b1421c51063182cc3116b9776eb3176919811665071e578" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x68bd448759fb61cacfe4fa04bf2756bd712a7b1495bf9ec0403568dfe8ea9e17", + "gas_used": 21000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "21000" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "1280249": "12345" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "14400", + "1280249": "9897655" + } + }, + "514b430000000000000000000000000000000003": { + "nonce": 1, + "code_hash": "0xb8596d7365c5c8d9b5177129efadab4489b96afcd13775c52fc304bd31396262", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999940000", + "1280249": "90000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "21000" + } + } + } + }, + { + "name": "native_token_as_gas_priced_at_zero", + "comment": "the manager answering zero is a refusal, not free gas (messages.py:243)", + "network": "devnet", + "full_shard_id": 1, + "expect": "rejected", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QETH": "10000000" + } + }, + "514b43000000000000000000000000000000000300000001": { + "balances": { + "QKC": "1000000000000000000" + }, + "code": "0x6064600052600060205260406000f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "3", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "12345", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 1280249, + "transfer_token_id": 1280249, + "version": 0, + "v": "27", + "r": "95243722348920504376668056695637889321155105003743482657399656598087485107629", + "s": "31988445337633001150564659717785962518963813406747053133043569680890181670625", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x1857622d120320262b1421c51063182cc3116b9776eb3176919811665071e578" + } + } + ], + "gas_used_start": 0, + "result": { + "rejected": true, + "error_type": "InvalidNativeToken", + "error": ": non-default gas token QETH not ready for being used to pay gas" + }, + "post_state_root": "0x53236344071fb383d750412e36e30942be113830bd9fd7cff5ba935f8d1f0a07", + "gas_used": 0, + "xshard_receive_gas_used": 0, + "block_fee_tokens": {}, + "receipts": [], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "1280249": "10000000" + } + }, + "514b430000000000000000000000000000000003": { + "nonce": 1, + "code_hash": "0xf753474372cb0c2e5446328840758fe6526e4a44d378e82de7f813c54043d395", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "native_token_as_gas_reserve_too_small", + "comment": "the manager has a price but not enough genesis token to settle the whole allowance at it (messages.py:253)", + "network": "devnet", + "full_shard_id": 1, + "expect": "rejected", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QETH": "10000000" + } + }, + "514b43000000000000000000000000000000000300000001": { + "balances": { + "QKC": "1000" + }, + "code": "0x6050600052600260205260406000f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "3", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "12345", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 1280249, + "transfer_token_id": 1280249, + "version": 0, + "v": "27", + "r": "95243722348920504376668056695637889321155105003743482657399656598087485107629", + "s": "31988445337633001150564659717785962518963813406747053133043569680890181670625", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x1857622d120320262b1421c51063182cc3116b9776eb3176919811665071e578" + } + } + ], + "gas_used_start": 0, + "result": { + "rejected": true, + "error_type": "InvalidNativeToken", + "error": ": non-default gas token QETH not enough reserve balance for conversion" + }, + "post_state_root": "0xb45ff8ef0c6f7afacccb2051b599adb698fcc1e91280f1e0eda281e58420f912", + "gas_used": 0, + "xshard_receive_gas_used": 0, + "block_fee_tokens": {}, + "receipts": [], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "1280249": "10000000" + } + }, + "514b430000000000000000000000000000000003": { + "nonce": 1, + "code_hash": "0xb8596d7365c5c8d9b5177129efadab4489b96afcd13775c52fc304bd31396262", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "mnt_balance_precompile", + "comment": "the balance precompile reads any token for any address at a flat 400 gas (specials.py:365)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000", + "QETH": "777" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 100000, + "to": "0x000000000000000000000000000000514b430005", + "value": "0", + "data": "0x00000000000000000000000019e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000000000000000000000000000000000000000000000000000000001388f9", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "63060275407552373977697338062211166124009765248533035963549448137594455177884", + "s": "4086528705737308203316691740583651266086611990879475985161191494426140959970", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x368907fea727d6468e4538643cfe92761f48ca8f06071614154c3395837fecb9" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x0000000000000000000000000000000000000000000000000000000000000309" + }, + "post_state_root": "0xbf4bb7919a3352dadb6cca6076cc1ef1cdc0fc09b889bb1262c9022c4a94110a", + "gas_used": 23128, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "11564" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 23128, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "000000000000000000000000000000514b430005": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999976872", + "1280249": "777" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "11564" + } + } + } + }, + { + "name": "mnt_mint_precompile_rejects_foreign_sender", + "comment": "minting is the auction contract's alone: called by anyone else the frame fails and its whole allowance is gone (specials.py:356)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 100000, + "to": "0x000000000000000000000000000000514b430004", + "value": "0", + "data": "0x00000000000000000000000019e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000000000000000000000000000000000000000000000000000000001388f900000000000000000000000000000000000000000000000000000000000003e8", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "75530525537811310074117980756539617638839794092361953774294635591084464538004", + "s": "47763598148774765854696474749247159528657063404444617668584487183284121918858", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x3e2945ca0cd6ecdd272db1bbb6acec18a3cb3e2a515301e4d398ae24ce042d74" + } + } + ], + "gas_used_start": 0, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0x5cb8288fa3fde94bcca3f17716c13e84550cd6da4c107a6fa2240872e5fa696f", + "gas_used": 100000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "50000" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 100000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "000000000000000000000000000000514b430004": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999900000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "50000" + } + } + } + }, + { + "name": "transfer_mnt_refusal_keeps_the_rest_of_the_gas", + "comment": "the transfer-token precompile refusing for want of balance costs only the call surcharge and hands the rest back (specials.py:264): the caller can still afford the store that follows, which it could not if the refusal had burned the frame", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x73bbbb0000000000000000000000000000000000bb600052621388f9602052670de0b6b3a76400006040526020608060606000600073000000000000000000000000000000514b43000261ea60f1600055602a60015500" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 300000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "64988277407414884430676272209717019506151073786108823506034087051129269020144", + "s": "43496922543408922549513211720197949302033763861141913312495146163656209354435", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xc9e57c200ee4e3efc297a49ef2fdd593abe114ce6e0f2742fe078f3585cf2207" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x06b1c1b4e440bd67a33b2d29ea77b8fbbeed8bd181829b30513cd5bce55e9730", + "gas_used": 80772, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "40386" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 80772, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999919228" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0xbeef8ccd4e63c480b8ef84d0210f48e94718c7ddc1040725d8b8acf0e7decdf6", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "40386" + } + } + } + }, + { + "name": "deploy_system_contract_returns_its_address", + "comment": "the deploy precompile answers with the address it deployed to, not with the code it deployed (messages.py:783), and a contract can read that off the return data", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x60016000526020602060206000600073000000000000000000000000000000514b4300036216e360f15060206020f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 2000000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "20463116364735949105472248460729649424865191184657728528682563562220067451177", + "s": "2379111557288721844298692226418495968075564126238844275072845498677868688631", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x75ed820c70fec67a22f1bd271ccde9266ffc5d9dcd9e00ce8fd8967676a6dc2f" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x514b430000000000000000000000000000000001000000000000000000000000" + }, + "post_state_root": "0x3be1c517a2e059f8e0fb47fcc3d67643e91dba5b743523a7754eadc9669f16a2", + "gas_used": 380540, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "190270" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 380540, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999619460" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0xd7c99c2e6ccbf516677a7057a1ab39293a77ad984d40540da8a5fea428fb9805", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "190270" + } + } + } + }, + { + "name": "create_under_a_shard_key", + "comment": "a CREATE in an ordinary frame derives its address from rlp([sender, full_shard_key, nonce]) (messages.py:704). Paired with the case below, which reaches the same code without a key", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "bbbb0000000000000000000000000000000000bb00000001": { + "balances": {}, + "code": "0x600060006000f060005260206000f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 300000, + "to": "0xbbbb0000000000000000000000000000000000bb", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "50968632647048703940645740025979348960057482471987425339580931904623140019314", + "s": "28061325192445473744857249980457224781773248399636760987318646226526025222524", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x3aba47630f5dc2d7fd924a1baa6414df599eb73a544c266c0c0c6773b48e1222" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x00000000000000000000000007536ecf56a70920069e350012648c74181b6132" + }, + "post_state_root": "0x9e4d8448b203432c613bac37ea1eca3cbd7ecd8ce749195d7725d4fb6b32ba7d", + "gas_used": 53024, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "26512" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 53024, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999946976" + } + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 2, + "code_hash": "0x8cf6e867cdcaa60156d0553ca8525f9427a04654d96d992b5b4f1247d83795c8", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "26512" + } + } + } + }, + { + "name": "create_under_transfer_mnt_has_no_shard_key", + "comment": "the transfer-token precompile builds its child message without a shard key (specials.py:265), so the same code deploys to Ethereum's rlp([sender, nonce]) address instead \u2014 a different account and a different state root", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x73bbbb0000000000000000000000000000000000bb600052618bb060205260006040526020608060606000600073000000000000000000000000000000514b43000262030d40f160005560206080f3" + }, + "bbbb0000000000000000000000000000000000bb00000001": { + "balances": {}, + "code": "0x600060006000f060005260206000f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 500000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "106580679857467749175446103080837070542870198824649010909739673325791029987798", + "s": "21160525324363364815967480358235561343919996833857043440150495389972403208845", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xd6d7b843f5cd968f2dace8bcc358a9a8118b075b71520e30f0b5dd2e19cb2487" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x0000000000000000000000005e5cb642a710fc17bcf0cc1e9a5e66b407bfbd11" + }, + "post_state_root": "0xd26adf28f41bbdc5ebbdb9c911289012098b8da8a7ae717d1c7fe6af1fb0bc96", + "gas_used": 73796, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "36898" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 73796, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999926204" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x0e726f501820f9907f3276873a2cf3364e18696d8bd8a72f2c13a16a08560307", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 2, + "code_hash": "0x8cf6e867cdcaa60156d0553ca8525f9427a04654d96d992b5b4f1247d83795c8", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "36898" + } + } + } + }, + { + "name": "contract_creation", + "comment": "a deployment: the address is keccak(rlp([sender, full_shard_key, nonce]))[12:], the top-level nonce does not move for the CREATE itself, and the receipt carries the address and its shard key (messages.py:704)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0x", + "value": "0", + "data": "0x69602a60005260206000f3600052600a6016f3", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "9090241967879439993469200935796930631960398218754281168628634888602636610679", + "s": "17261168386981215795344729925724422448008204571276498376987089739682382738729", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xd5d6d9a3804d14e583850b48d8e936a0417f64d36695262461807dc5f9f8c90d" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x2e51de24dc44092078776c0c6d31d5837cf8e13f" + }, + "post_state_root": "0xbfa80749831241efd821fad7dbaa9a650623dedf84436769d716543f27fdea99", + "gas_used": 56118, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "28059" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 56118, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x2e51de24dc44092078776c0c6d31d5837cf8e13f", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999943882" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "28059" + } + } + } + }, + { + "name": "contract_call_returns_value", + "comment": "calling deployed code: the return data reaches the caller and the gas actually burned is what the receipt records", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x602a60005260206000f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "12735107450827754314996413550028961088786175550436629053958101343663358218811", + "s": "21635779728609379652362182518843607712493120617284932344778009759404867596184", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xe3482981c6b6ac10dac2b1d4922cda3f6499b295bd1af66723b1935fc8f2a6c6" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x000000000000000000000000000000000000000000000000000000000000002a" + }, + "post_state_root": "0x73727f9540f861a4e68b867e2965d17a5b0d8d21f6954a622ba532f27898f90a", + "gas_used": 21018, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "10509" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21018, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999978982" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x98e3a357b0a9519e7773d42cf7912a620a18c8f53cd8e1525ce5344917d07e76", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "10509" + } + } + } + }, + { + "name": "contract_revert", + "comment": "a reverting call is a failed transaction, not a rejected one: the state goes back, the gas is gone and the receipt says so", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x60006000fd" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "1000", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "17850951321665825387657461623582934598422271336066609985576422160624028565948", + "s": "26672676581782673257474220191443995910379934421583152445555941578555475944141", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x233329023cba5d1b20adc3556d7e60e59b7b4fd9686dc45759298736d3d44643" + } + } + ], + "gas_used_start": 0, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0x3cd0ffa3afaddb8e5281cf266ae3aec2c45aca58465abebc7cb520e8f767cb5d", + "gas_used": 21006, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "10503" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 21006, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999978994" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x9c8d1cd1e8729d5714bbb461fcce463172f4b1c3ae57698a589dc69a747d4051", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "10503" + } + } + } + }, + { + "name": "contract_out_of_gas", + "comment": "running out of gas costs the whole allowance and leaves the value where it started", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x5b600056" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 50000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "1000", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "114549537878155032124804814621309620047419671812453021763988112318428525260906", + "s": "28246659255777291244556875721186412405704111892024620031354434081036050791815", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x1cce94966516c70ef05a089cc54ef215b95be0b8cd46375fe472ca74ef9356ba" + } + } + ], + "gas_used_start": 0, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0xae264ed45c90949a628dd5680690369c6336391f011920af9c7f4b2d21fa34b1", + "gas_used": 50000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "25000" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 50000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999950000" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x6e2fbd89d498da8e2419f09dbc06a84ae3f5b9c73961a65c9272efecb85b5ee4", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "25000" + } + } + } + }, + { + "name": "contract_selfdestruct", + "comment": "the suicide list is applied after the message, not at the opcode (messages.py:351): the balance moves to the beneficiary and del_account strips the account, which the end-of-block sweep then drops", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "5000" + }, + "code": "0x73bbbb0000000000000000000000000000000000bbff" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "12735107450827754314996413550028961088786175550436629053958101343663358218811", + "s": "21635779728609379652362182518843607712493120617284932344778009759404867596184", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xe3482981c6b6ac10dac2b1d4922cda3f6499b295bd1af66723b1935fc8f2a6c6" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x5600d2134623eb0cc927a647c6bf915d0f91ad6aa676d1b3dec2771685655b93", + "gas_used": 27003, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "13501" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 27003, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999972997" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "13501" + } + } + } + }, + { + "name": "contract_logs_and_bloom", + "comment": "one log with one topic: the receipt's bloom and the block's are built from it", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x7fbeef000000000000000000000000000000000000000000000000000000000060206000a100" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "12735107450827754314996413550028961088786175550436629053958101343663358218811", + "s": "21635779728609379652362182518843607712493120617284932344778009759404867596184", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xe3482981c6b6ac10dac2b1d4922cda3f6499b295bd1af66723b1935fc8f2a6c6" + } + } + ], + "gas_used_start": 0, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0xe071b56775bd63b4aa2c541f70a89c0f9b9b12e48cd6976f07c204abef4bf135", + "gas_used": 200000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "100000" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 200000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999800000" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x882ff4a151eb9807e2d0ac89f1f57e29987a86b6f99d87a27e0c6d6e76314a63", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "100000" + } + } + } + }, + { + "name": "contract_create2", + "comment": "CREATE2 from inside a frame: unlike a top-level CREATE, a nested one moves the creator's nonce", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6460006000f360005260006005601b6000f500" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "12735107450827754314996413550028961088786175550436629053958101343663358218811", + "s": "21635779728609379652362182518843607712493120617284932344778009759404867596184", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xe3482981c6b6ac10dac2b1d4922cda3f6499b295bd1af66723b1935fc8f2a6c6" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x4da159fe1f6c2b3e3d9a9e9612178a85f478b85b49cf87e5912dd5da30032f82", + "gas_used": 53036, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "26518" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 53036, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999946964" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 2, + "code_hash": "0xe1fa1e0efbcfe58df3624954abfac34a2b0e0ce6fd8307f3b43d2fc3727497a0", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "26518" + } + } + } + }, + { + "name": "create2_word_gas_underflows", + "comment": "CREATE2's per-word charge is subtracted unchecked and the memory it is charged for needs no growing, so the frame carries a negative gas counter past the point anything would notice it; with CREATE2 last, the frame hands that counter back and apply_transaction trips its own `assert gas_remained >= 0` (messages.py:305). The transaction is not refused for a reason -- pyquarkchain cannot process it at all, so no block containing it exists", + "network": "devnet", + "full_shard_id": 1, + "expect": "rejected", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6000610be0526000610c0060006000f5" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 53500, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "597902601262657265624722210580897406987520543669649996700362526082170247999", + "s": "2777299912825643025837406676573787197657175596000636441731879062431711095029", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x80cee19476dd4871dea33b8c9ef56a30dd9a3009f357f8faf6a55469bae5ad41" + } + } + ], + "gas_used_start": 0, + "result": { + "rejected": true, + "error_type": "AssertionError", + "error": "" + }, + "post_state_root": "0xfcc68a8310cd1ed9846443526d2d946263674d0b2baf51306221bca8425ccc10", + "gas_used": 0, + "xshard_receive_gas_used": 0, + "block_fee_tokens": {}, + "receipts": [], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999946500" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 2, + "code_hash": "0xe85e9496874f0de902ba2d17fc8c7a7c2178e3e7c53fcd3c585bec4ef7c2aaab", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "create2_word_gas_covered", + "comment": "the same code with the word charge paid for, which is what makes the case above readable: same frame, 500 more gas, and the deployment goes through normally", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6000610be0526000610c0060006000f5" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 54000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "34795149288362580428093174716464757860927417270442819484278944886380881001799", + "s": "56427249645011984794885631786856209178140615410427938901299491782400075285401", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xdcaddc259f00e3d298f7f549f99605653d662f9ad282bafca2afb8389810a68b" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x1506f87f0df53f2335cd60784d3ef9247c0505f905c933e305ac0d12a578f496", + "gas_used": 53903, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "26951" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 53903, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999946097" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 2, + "code_hash": "0xe85e9496874f0de902ba2d17fc8c7a7c2178e3e7c53fcd3c585bec4ef7c2aaab", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "26951" + } + } + } + }, + { + "name": "create2_word_gas_oog_while_growing", + "comment": "the same shortfall with the memory still to grow: mem_extend checks before it spends, so both sides simply run out of gas and the transaction is processed with a failed receipt. This is the case that keeps the boundary above from swallowing an ordinary out-of-gas and abandoning a block that is fine", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6000610c0060006000f5" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 53500, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "597902601262657265624722210580897406987520543669649996700362526082170247999", + "s": "2777299912825643025837406676573787197657175596000636441731879062431711095029", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x80cee19476dd4871dea33b8c9ef56a30dd9a3009f357f8faf6a55469bae5ad41" + } + } + ], + "gas_used_start": 0, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0x3b42015ae04ec705566c463aea1f8ec7f8e2e43dfcafe3b3d7db0090d25e9b35", + "gas_used": 53500, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "26750" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 53500, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999946500" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0xad920eb4191d4428339fa111dc20f0acd5815269eea4daca7975965020ee8e27", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "26750" + } + } + } + }, + { + "name": "nested_call", + "comment": "a call inside a call: the inner frame's gas comes out of the outer one's and both are settled once, at the top", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6000600060006000600073bbbb0000000000000000000000000000000000bb5af100" + }, + "bbbb0000000000000000000000000000000000bb00000001": { + "balances": {}, + "code": "0x602a60005260206000f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "12735107450827754314996413550028961088786175550436629053958101343663358218811", + "s": "21635779728609379652362182518843607712493120617284932344778009759404867596184", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xe3482981c6b6ac10dac2b1d4922cda3f6499b295bd1af66723b1935fc8f2a6c6" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x3363afb11652ab69a949484e203d2ab205e0af13bdf568400c46804920126131", + "gas_used": 21738, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "10869" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21738, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999978262" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x305d9e3216a87bcd3d09a0a5d46fbe5af49660b18a9fa8a276f8f27630afa6d5", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 1, + "code_hash": "0x98e3a357b0a9519e7773d42cf7912a620a18c8f53cd8e1525ce5344917d07e76", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "10869" + } + } + } + }, + { + "name": "eip155_transfer", + "comment": "a version 2 (EIP155) transaction, which devnet enables at genesis: the sender is recovered under Ethereum's rules and the shard keys must both be zero (messages.py:139-183)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "100", + "data": "0x", + "network_id": 110001, + "from_full_shard_key": 0, + "to_full_shard_key": 0, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 2, + "v": "220038", + "r": "60353123895970295551229215371053175572533741372452359547566495391553326743989", + "s": "21085269874213612843685062057545865264052501255086239559140164392259721102705", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x46f4368da958f491a0200cbf16223ac35e8e73f7cc20f17e08d36018fc675096" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0xb708cf6981e48ba49dfc1b6662a7753caa32015dfb213d4648dcf097339678f8", + "gas_used": 21000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "10500" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 0, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "100" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999978900" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "10500" + } + } + } + }, + { + "name": "eip155_before_enable_timestamp", + "comment": "mainnet only enables the EIP155 signer in 2021; before that the version is refused whatever else it says", + "network": "mainnet", + "full_shard_id": 1, + "expect": "rejected", + "context": { + "timestamp": 1569567600, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "100", + "data": "0x", + "network_id": 100001, + "from_full_shard_key": 0, + "to_full_shard_key": 0, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 2, + "v": "200037", + "r": "31869815527869031967038248808710975252650229820597379225999880556612926582874", + "s": "152050561646782358823596613957735286776139017963811964976857671185677528371", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x606b6ee5f78ae06f194e89a84ee1d1848255cb27797c91cb5d65db988bf250bb" + } + } + ], + "gas_used_start": 0, + "result": { + "rejected": true, + "error_type": "InvalidTransaction", + "error": "EIP155 Signer is not enable yet." + }, + "post_state_root": "0x10a4104584d3cf2cbfc5cd66284fbffd41296e9d21e14d311e8a456a6c6f5b61", + "gas_used": 0, + "xshard_receive_gas_used": 0, + "block_fee_tokens": {}, + "receipts": [], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "eip155_non_default_token", + "comment": "the EIP155 signer has no field for a token, so both must be the chain's own", + "network": "devnet", + "full_shard_id": 1, + "expect": "rejected", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000", + "QETH": "99999" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "100", + "data": "0x", + "network_id": 110001, + "from_full_shard_key": 0, + "to_full_shard_key": 0, + "gas_token_id": 35760, + "transfer_token_id": 1280249, + "version": 2, + "v": "220038", + "r": "60353123895970295551229215371053175572533741372452359547566495391553326743989", + "s": "21085269874213612843685062057545865264052501255086239559140164392259721102705", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x0bdf378bb66ef11c2143f982783f255d4fe1c39fff7d0008993745ff3900d7be" + } + } + ], + "gas_used_start": 0, + "result": { + "rejected": true, + "error_type": "InvalidTransaction", + "error": "EIP155 Signer only support QKC as transfer token." + }, + "post_state_root": "0xf93e16878d9bcda4ebe495b5b58e69ee07c6976d248162f5af3b9d17e5f58406", + "gas_used": 0, + "xshard_receive_gas_used": 0, + "block_fee_tokens": {}, + "receipts": [], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000", + "1280249": "99999" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "eip155_non_zero_shard_key", + "comment": "a non-zero shard key is how a version 2 transaction would become cross-shard, which the signer does not support", + "network": "devnet", + "full_shard_id": 1, + "expect": "rejected", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 30000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "100", + "data": "0x", + "network_id": 110001, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 2, + "v": "220038", + "r": "60353123895970295551229215371053175572533741372452359547566495391553326743989", + "s": "21085269874213612843685062057545865264052501255086239559140164392259721102705", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x072882186aa90cb7678d78471c6a1fa402a8c452f61ef58a9bdcfafebe8ec2a0" + } + } + ], + "gas_used_start": 0, + "result": { + "rejected": true, + "error_type": "InvalidTransaction", + "error": "EIP155 Signer do not support cross shard transaction." + }, + "post_state_root": "0x10a4104584d3cf2cbfc5cd66284fbffd41296e9d21e14d311e8a456a6c6f5b61", + "gas_used": 0, + "xshard_receive_gas_used": 0, + "block_fee_tokens": {}, + "receipts": [], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "xshard_source_transfer", + "comment": "the source half of a cross-shard transfer: the value leaves, a deposit carries the whole remaining allowance to the target, and the surcharge is left out of both the fee and gas_used (messages.py:520-560)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "2", + "start_gas": 60000, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "value": "1000", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 65537, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "37389429576641309970465032198525171023027754588148195340326153206674943208801", + "s": "36712403990280134199624124602677278289448544510145958723662789411131013188609", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x601c643ba3134978025670ea87aaf07f2488e85ddc916e9168b64d5d573239b4" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x2b5c8323d31aa8b2d4ab1f36e6fa0241a3628c70c84fa7df07e8eb867b86f3ec", + "gas_used": 21000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "21000" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 21000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 65537, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [ + { + "tx_hash": "0x601c643ba3134978025670ea87aaf07f2488e85ddc916e9168b64d5d573239b4", + "from": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "from_full_shard_key": 1, + "to": "0x1563915e194d8cfba1943570603f7606a3115508", + "to_full_shard_key": 65537, + "value": "1000", + "gas_price": "2", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "30000", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + ], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 65537, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999879000" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 65537, + "exists": true, + "balances": { + "35760": "21000" + } + } + } + }, + { + "name": "xshard_source_contract_creation", + "comment": "a cross-shard deployment: the address is derived here, from the sender's nonce as it now stands, and the code is deployed on the target (messages.py:494)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "2", + "start_gas": 200000, + "to": "0x", + "value": "500", + "data": "0x69602a60005260206000f3600052600a6016f3", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 65537, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "108382354851356721883857006921347255407421428793263935582134464079087689207139", + "s": "5250221335569262145212198165330714403826353639952683090473027033438613226921", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x3611dc9faccf1a273aac53b203ef933177da05fa954505566f4c62e87ba2016a" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x87270429fae9b80b6854530004ff85df819dba225e27d60a2ca7f131af1c560a", + "gas_used": 54100, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "54100" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 54100, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 65537, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [ + { + "tx_hash": "0x3611dc9faccf1a273aac53b203ef933177da05fa954505566f4c62e87ba2016a", + "from": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "from_full_shard_key": 1, + "to": "0xdeca9285d8a938265576983b65de1f1f6f979333", + "to_full_shard_key": 65537, + "value": "500", + "gas_price": "2", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "136900", + "message_data": "0x69602a60005260206000f3600052600a6016f3", + "create_contract": true, + "is_from_root_chain": false, + "refund_rate": 100 + } + ], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999599500" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 65537, + "exists": true, + "balances": { + "35760": "54100" + } + } + } + }, + { + "name": "xshard_deposit_failed_message_leaves_funds_with_sender", + "comment": "the deposit credits the sender on this shard first and only then moves the value by a message; when that message fails the money stays with the sender here rather than going back (messages.py:368-377)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x60006000fd" + } + }, + "inputs": [ + { + "kind": "deposit", + "deposit": { + "tx_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", + "from": "0xbbbb0000000000000000000000000000000000bb", + "from_full_shard_key": 1, + "to": "0xaaaa0000000000000000000000000000000000aa", + "to_full_shard_key": 1, + "value": "1000", + "gas_price": "1", + "gas_token_id": 35760, + "transfer_token_id": 35760, + "gas_remained": "100000", + "message_data": "0x", + "create_contract": false, + "is_from_root_chain": false, + "refund_rate": 100 + } + } + ], + "gas_used_start": 9000, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0xc49a2e7ea646455afd692eed0e126196eeb2d1d199188e8ba1db067050c642b1", + "gas_used": 9006, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "4503" + }, + "receipts": [], + "xshard_deposit_receipts": [ + { + "success": false, + "cumulative_gas_used": 9006, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_list": [], + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x9c8d1cd1e8729d5714bbb461fcce463172f4b1c3ae57698a589dc69a747d4051", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "100994" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "4503" + } + } + } + }, + { + "name": "mnt_balance_precompile_pads_short_calldata", + "comment": "the balance precompile reads its arguments with extract32 (vm.py:59), so calldata that stops after the address is not refused: the token id reads as zero and the call succeeds at the same flat 400 gas", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000", + "QETH": "777" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 100000, + "to": "0x000000000000000000000000000000514b430005", + "value": "0", + "data": "0x00000000000000000000000019e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "11221264534936978232387302496339600018092558688481858457347593771523181963313", + "s": "12094467103083589126806689186273433454855034440617740646636047674823442840964", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xfb15b0286211724acab850209ffbf799ba23abf84f3c595382a19cde810eeb32" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + "post_state_root": "0xf2acd158e47dcf941e4ad481a3515851bc1c6d2431a987561ec09ede9ada539e", + "gas_used": 22808, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "11404" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 22808, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "000000000000000000000000000000514b430005": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999977192", + "1280249": "777" + } + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "11404" + } + } + } + }, + { + "name": "mnt_mint_precompile_pads_short_calldata", + "comment": "the mint precompile reads its amount with extract32 as well: 80 bytes of calldata leaves the amount word half off the end, and what is minted is that half padded with zeros, not a refusal", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "1563915e194d8cfba1943570603f7606a311550800000001": { + "balances": { + "QKC": "1000" + } + }, + "514b43000000000000000000000000000000000200000001": { + "balances": {}, + "code": "0x731563915e194d8cfba1943570603f7606a3115508600052621388f96020527001000000000000000000000000000000006040526020608060506000600073000000000000000000000000000000514b430004620186a0f1600055" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0x514b430000000000000000000000000000000002", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "74031299957299120008676632546965524877207232031650110915030611234648841497242", + "s": "50762997691606763156784788429827080579940559941733928152207610782467621421805", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xbdb809fabb79d9afeee7853e09ca49ce2fcb4d2de6d45218f7cc3e792915fe24" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0xb08759ffbdf6e6ed1f228f8f09bc14a86efaa7d78415740fe1c1dbc49b5d3c80", + "gas_used": 50766, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "25383" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 50766, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "1563915e194d8cfba1943570603f7606a3115508": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000", + "1280249": "340282366920938463463374607431768211456" + } + }, + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999949234" + } + }, + "514b430000000000000000000000000000000002": { + "nonce": 1, + "code_hash": "0xbee353771204f2fef4d13d76376f480fa0882e184c2d61992ca7caf7718654dc", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "25383" + } + } + } + }, + { + "name": "sstore_legacy_pricing", + "comment": "SSTORE is metered the pre-EIP-1283 way \u2014 20000 for a clean zero to non-zero, 5000 otherwise, and a flat 15000 refund for clearing \u2014 including for a slot the same transaction writes twice", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x600060005560076002556003600155600060015560016003556002600355", + "storage": { + "0x1": "0x1" + } + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "12735107450827754314996413550028961088786175550436629053958101343663358218811", + "s": "21635779728609379652362182518843607712493120617284932344778009759404867596184", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xe3482981c6b6ac10dac2b1d4922cda3f6499b295bd1af66723b1935fc8f2a6c6" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x79261628793264da27a891ef1a134764967a11b3d487c174beb70864a4dfe582", + "gas_used": 66036, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "33018" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 66036, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999933964" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0xe90c4fa75405079334397a5b20603170dc6752e6f954561a0967c53178378816", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "33018" + } + } + } + }, + { + "name": "returndatacopy_within_the_answer", + "comment": "copying exactly as many bytes as the last call returned is in range (vm.py:542)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6000600060006000600073bbbb0000000000000000000000000000000000bb620186a0f1506020600060003e600060005155" + }, + "bbbb0000000000000000000000000000000000bb00000001": { + "balances": {}, + "code": "0x602a60005260206000f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "12735107450827754314996413550028961088786175550436629053958101343663358218811", + "s": "21635779728609379652362182518843607712493120617284932344778009759404867596184", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xe3482981c6b6ac10dac2b1d4922cda3f6499b295bd1af66723b1935fc8f2a6c6" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x67a0dc78cb4f3995c6eb07a62d254b52d2159704f57260e764fe6e7114baad38", + "gas_used": 26768, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "13384" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 26768, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999973232" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x0401198775055616d17e28a4b69b654a5dbd01c75957446f86142aa9d2f0200e", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 1, + "code_hash": "0x98e3a357b0a9519e7773d42cf7912a620a18c8f53cd8e1525ce5344917d07e76", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "13384" + } + } + } + }, + { + "name": "returndatacopy_past_the_answer", + "comment": "one byte past what the last call returned is an exception, and an exception costs the frame everything it had left", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6000600060006000600073bbbb0000000000000000000000000000000000bb620186a0f1506021600060003e600060005155" + }, + "bbbb0000000000000000000000000000000000bb00000001": { + "balances": {}, + "code": "0x602a60005260206000f3" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "12735107450827754314996413550028961088786175550436629053958101343663358218811", + "s": "21635779728609379652362182518843607712493120617284932344778009759404867596184", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xe3482981c6b6ac10dac2b1d4922cda3f6499b295bd1af66723b1935fc8f2a6c6" + } + } + ], + "gas_used_start": 0, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0xc32947aeb41daed03e05a14909f855c1a5f34d2557d0253c9d636ffaac11da8c", + "gas_used": 200000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "100000" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 200000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999800000" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0xe2a5f59aa5e9ae444ecc17936d24f7ad52bad44347a0439e345488b889d1186c", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 1, + "code_hash": "0x98e3a357b0a9519e7773d42cf7912a620a18c8f53cd8e1525ce5344917d07e76", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "100000" + } + } + } + }, + { + "name": "create_init_code_reverts", + "comment": "init code that reverts leaves no contract and pushes zero, and the creating frame keeps what the init code did not spend (messages.py:793)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6460006000fd6000526005601b6000f0600055" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 200000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "12735107450827754314996413550028961088786175550436629053958101343663358218811", + "s": "21635779728609379652362182518843607712493120617284932344778009759404867596184", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0xe3482981c6b6ac10dac2b1d4922cda3f6499b295bd1af66723b1935fc8f2a6c6" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x0722a2e0e16f413651aa57a4cb59e15a8873b049f60104da79e5d3f0fa23582c", + "gas_used": 58030, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "29015" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 58030, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999941970" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 2, + "code_hash": "0x55a6e2f416994b88b72fdb523df12288c0ed7a0906af454d99f42ff76878a715", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "29015" + } + } + } + }, + { + "name": "create_code_store_out_of_gas", + "comment": "paying for the deployed code is all or nothing: too little gas for the 200-per-byte charge reverts the deployment and takes the rest of the gas with it (messages.py:781)", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6460646000f36000526005601b6000f0600055" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 60000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "21394698942900175259459025223255958933179829316943537984365292708694581496756", + "s": "37812663471387482254394314093225656638508741364049919753005094314770461714964", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x821cddec96977b6f3faf1e6c8522decc4b926cffe3aae7e9cdc8377b853cd2b3" + } + } + ], + "gas_used_start": 0, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0x47e90f77c15aeeb05645b2da7094f04a66e59c0928decdc24f465ead43d19b55", + "gas_used": 60000, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "30000" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 60000, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999940000" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x0ff358b676f77fa2efdc5cbc8f202504709a19ecd3cad6889cb94f1dbaf97fa2", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "30000" + } + } + } + }, + { + "name": "create_code_too_large", + "comment": "one byte over the 24576 limit fails the same way, whatever gas is left", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x656160016000f36000526006601a6000f0600055" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 8000000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "37378989991440538646723930995959647967638989282152532335329301164247468790915", + "s": "42118358097031798326779256548736373729191616817791619494470428603411135276822", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x51994e78cc3bd3d15ae0324ccd3b8942f5066f599ff05a69b8622198164e5099" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x621d1f188eaaaa10ddacceb3841fb4eac3994f70888c675d3e17d7f1993963d5", + "gas_used": 7880832, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "3940416" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 7880832, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999992119168" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 2, + "code_hash": "0x44becc5f8617e33a50383a45da6308a70a8ce789aa89d7908e86e3dd0e30a1dd", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "3940416" + } + } + } + } + ] +} diff --git a/qkc/testdata/exec_golden/state_level.json b/qkc/testdata/exec_golden/state_level.json new file mode 100644 index 00000000000..76ff45a5b37 --- /dev/null +++ b/qkc/testdata/exec_golden/state_level.json @@ -0,0 +1,779 @@ +{ + "_comment": [ + "Direct EvmState mutations and the state root they commit to, generated by", + "qkc/testdata/gen_exec_golden.py against pyquarkchain. The genesis_alloc_*", + "cases are the generator's self-check against minor_genesis_golden.json.", + "Allocations are committed before a case's operations run, so the", + "operations start from a state that has been through the trie." + ], + "source": { + "pyquarkchain_commit": "75f8d7e166df0f5a2579ffe37ea7b4f5ba79db60", + "dirty_modules": [], + "module_digests": { + "quarkchain/evm/messages.py": "7d6cb97202b0e5e7", + "quarkchain/evm/state.py": "de5216e6c10e606e", + "quarkchain/evm/transactions.py": "573f578989e912a1", + "quarkchain/evm/specials.py": "c14638312c952401", + "quarkchain/evm/opcodes.py": "40d1eaab9bb6612a", + "quarkchain/cluster/shard_state.py": "9cc7a3ff57b383b5", + "quarkchain/core.py": "3f6d1865eb449b80", + "quarkchain/genesis.py": "15d80022b9b6aa0b", + "quarkchain/config.py": "cda1b5ca536bb8af", + "quarkchain/utils.py": "33ec76129f0d8269" + } + }, + "cases": [ + { + "name": "genesis_alloc_mainnet", + "comment": "self-check: the shipped genesis ALLOC must reproduce the pinned minor genesis state root", + "network": "mainnet", + "full_shard_id": 1, + "pre_alloc": { + "32c53C6c2B57B2026a51C87aDD0695F5AeEd3f2e000075b2": { + "balances": { + "QKC": "600000000000000000000000000" + } + }, + "7DeB90eF2097D8A9e423516e199b9D95EB2b4D97000075b2": { + "balances": { + "QKC": "100000000000000000000000000" + } + }, + "c4fbA3740f95d25B2196C9437fDb005359296D36000075b2": { + "balances": { + "QKC": "50000000000000000000000000" + } + } + }, + "pre_state_root": "0x699737e3597ea304b7d2e2f4ecbf8ab6348688287c59cec8599cf7a4f7c82153", + "ops": [], + "post_state_root": "0x699737e3597ea304b7d2e2f4ecbf8ab6348688287c59cec8599cf7a4f7c82153", + "accounts": { + "32c53C6c2B57B2026a51C87aDD0695F5AeEd3f2e": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 30130, + "exists": true, + "balances": { + "35760": "600000000000000000000000000" + } + }, + "7DeB90eF2097D8A9e423516e199b9D95EB2b4D97": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 30130, + "exists": true, + "balances": { + "35760": "100000000000000000000000000" + } + }, + "c4fbA3740f95d25B2196C9437fDb005359296D36": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 30130, + "exists": true, + "balances": { + "35760": "50000000000000000000000000" + } + } + } + }, + { + "name": "genesis_alloc_devnet", + "comment": "self-check: the shipped genesis ALLOC must reproduce the pinned minor genesis state root", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "a92885095A33E45A3C018Df7Aa6242B62Acb971800000000": { + "balances": { + "QKC": "600000000000000000000000000" + } + }, + "5C935469C5592Aeeac3372e922d9bCEabDF8830d00000000": { + "balances": { + "QKC": "600000000000000000000000000" + } + } + }, + "pre_state_root": "0x76b7e413ee8a10d27ad5158ce91b8b8e61d6af8805b965a4ce11b93db0286ed1", + "ops": [], + "post_state_root": "0x76b7e413ee8a10d27ad5158ce91b8b8e61d6af8805b965a4ce11b93db0286ed1", + "accounts": { + "5C935469C5592Aeeac3372e922d9bCEabDF8830d": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "600000000000000000000000000" + } + }, + "a92885095A33E45A3C018Df7Aa6242B62Acb9718": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": true, + "balances": { + "35760": "600000000000000000000000000" + } + } + } + }, + { + "name": "touched_blank_account_pruned", + "comment": "a zero-value delta only marks the account touched; commit deletes it rather than writing a blank leaf (state.py:562-586)", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": {}, + "pre_state_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "ops": [ + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "QKC", + "value": "0" + } + ], + "post_state_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 0, + "exists": false, + "balances": {} + } + } + }, + { + "name": "drained_account_pruned", + "comment": "an account whose only balance goes back to zero is blank again and leaves the trie", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "pre_state_root": "0x26a59a755c9b9897df35b2c21080424ea51cbbbe865963a65209d10032cf2859", + "ops": [ + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "QKC", + "value": "-1000000000000000000" + } + ], + "post_state_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "nonce_keeps_account", + "comment": "nonce alone defeats is_blank, so a balance-less account stays in the trie", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": {}, + "pre_state_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "ops": [ + { + "op": "set_full_shard_key", + "value": 1 + }, + { + "op": "increment_nonce", + "address": "aaaa0000000000000000000000000000000000aa" + } + ], + "post_state_root": "0xab9b364fb51cd02e2c5d450eabbcd48b22424b7a9656077e183d703e776f5186", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": {} + } + } + }, + { + "name": "full_shard_key_freezes_at_first_read", + "comment": "the shard key stamped into a new account is the one current when the address was first looked up, not when it was first written: get_and_cache_account builds the blank account with state.full_shard_key and caches it (state.py:387), and the cache lives until commit. A is read under key 1 and written under key 2, so its leaf carries 1; B is only ever written, so it carries 2 and shows what the other would have looked like", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": {}, + "pre_state_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "ops": [ + { + "op": "set_full_shard_key", + "value": 1 + }, + { + "op": "read_account", + "address": "aaaa0000000000000000000000000000000000aa" + }, + { + "op": "set_full_shard_key", + "value": 2 + }, + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "QKC", + "value": "5" + }, + { + "op": "delta_token_balance", + "address": "bbbb0000000000000000000000000000000000bb", + "token": "QKC", + "value": "5" + } + ], + "post_state_root": "0x011bdcd8b9da1b3ed8d7903332a5fbd63d9612d48813a7fa864aede375eac5d8", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "5" + } + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 2, + "exists": true, + "balances": { + "35760": "5" + } + } + } + }, + { + "name": "storage_alone_prunes_account", + "comment": "storage does not defeat is_blank: the account is dropped and its storage trie becomes unreachable", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": {}, + "pre_state_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "ops": [ + { + "op": "set_full_shard_key", + "value": 1 + }, + { + "op": "set_storage", + "address": "aaaa0000000000000000000000000000000000aa", + "key": "0x01", + "value": "0x2a" + } + ], + "post_state_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {}, + "storage": { + "0x01": "0x0" + } + } + } + }, + { + "name": "storage_zero_deletes_slot", + "comment": "writing zero deletes the slot instead of storing it (state.py:236-241)", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "5" + }, + "code": "0x6000", + "storage": { + "0x01": "0x2a", + "0x02": "0x2b" + } + } + }, + "pre_state_root": "0x7f9a01e748017171f1fe105c56bfa5af6880b496a81cc88b338bfeaf86acc093", + "ops": [ + { + "op": "set_storage", + "address": "aaaa0000000000000000000000000000000000aa", + "key": "0x01", + "value": "0x0" + } + ], + "post_state_root": "0x6b7cda7c73231858d736dc391faed843ea26caf3a6095aee66221f3a580d3567", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x07ad118d6cc8642c86c03827f276d8b791a65e5c99a3845faf186be720a1455d", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "5" + }, + "storage": { + "0x01": "0x0", + "0x02": "0x2b" + } + } + } + }, + { + "name": "token_blob_sorted_and_zero_free", + "comment": "the balance blob is ordered by token id and carries no zero entries, whatever order they were written in", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": {}, + "pre_state_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "ops": [ + { + "op": "set_full_shard_key", + "value": 1 + }, + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "ZZZ", + "value": "3" + }, + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "QKC", + "value": "1" + }, + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "BTC", + "value": "2" + }, + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "AAA", + "value": "7" + }, + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "AAA", + "value": "-7" + } + ], + "post_state_root": "0xbfef29ce8b851aac0e64d36fad991510ae08a467a088707f878803f2b29b4aa9", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "16644": "2", + "35760": "1", + "47987": "3" + } + } + } + }, + { + "name": "del_account_removes_leaf", + "comment": "del_account clears balances, nonce, code and storage and unsets touched, so commit deletes the leaf (state.py:596-610)", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "9" + }, + "code": "0x6001", + "storage": { + "0x01": "0x2a" + } + } + }, + "pre_state_root": "0xc99b166e946e1b0ecd5a831dfb2c3cb2d89b2c5394d277ed922c4e88c394530d", + "ops": [ + { + "op": "del_account", + "address": "aaaa0000000000000000000000000000000000aa" + } + ], + "post_state_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {}, + "storage": { + "0x01": "0x0" + } + } + } + }, + { + "name": "revert_undoes_mutations", + "comment": "snapshot/revert restores balances, nonce, code and storage; the post root equals the untouched allocation's", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "1000000000000000000" + } + } + }, + "pre_state_root": "0x26a59a755c9b9897df35b2c21080424ea51cbbbe865963a65209d10032cf2859", + "ops": [ + { + "op": "snapshot" + }, + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "QKC", + "value": "7" + }, + { + "op": "delta_token_balance", + "address": "bbbb0000000000000000000000000000000000bb", + "token": "QKC", + "value": "5" + }, + { + "op": "increment_nonce", + "address": "aaaa0000000000000000000000000000000000aa" + }, + { + "op": "set_code", + "address": "aaaa0000000000000000000000000000000000aa", + "code": "0x6002" + }, + { + "op": "set_storage", + "address": "aaaa0000000000000000000000000000000000aa", + "key": "0x01", + "value": "0x2a" + }, + { + "op": "revert" + } + ], + "post_state_root": "0x26a59a755c9b9897df35b2c21080424ea51cbbbe865963a65209d10032cf2859", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "1000000000000000000" + }, + "storage": { + "0x01": "0x0" + } + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": false, + "balances": {} + } + } + }, + { + "name": "zeroed_token_entry_is_not_absent", + "comment": "a balance set to zero leaves the entry in the map, so the blob is an empty pair list rather than empty bytes; only an account that never held the token serializes to nothing (state.py:144-150)", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "5" + }, + "code": "0x6000" + }, + "bbbb0000000000000000000000000000000000bb00000001": { + "code": "0x6000" + } + }, + "pre_state_root": "0x25e3e4c546ad100dd20a7a67c052e8e36e0f86a80b1d5c42af6ad832fe807623", + "ops": [ + { + "op": "set_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "QKC", + "value": "0" + } + ], + "post_state_root": "0xcd41ba57b0f922680a53a1968b8182c3409092e76a52be4cae80bed46a3bfa19", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x07ad118d6cc8642c86c03827f276d8b791a65e5c99a3845faf186be720a1455d", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 1, + "code_hash": "0x07ad118d6cc8642c86c03827f276d8b791a65e5c99a3845faf186be720a1455d", + "full_shard_key": 1, + "exists": true, + "balances": {} + } + } + }, + { + "name": "revert_does_not_restore_reset_balances", + "comment": "reset_balances journals the restore onto a misspelled attribute (state.py:192-198), so reverting brings back the token trie but not the balances; the account stays drained. The opening credit is what makes that observable: reset_balances marks nothing touched, so without it commit would skip the account and both a faithful and a naively correct implementation would agree", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "5" + }, + "code": "0x6000" + } + }, + "pre_state_root": "0x51f9e0b983d418c7cf59d0d24f17f99b552ab943f02152d0b94962206f992399", + "ops": [ + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "QKC", + "value": "1" + }, + { + "op": "snapshot" + }, + { + "op": "reset_balances", + "address": "aaaa0000000000000000000000000000000000aa" + }, + { + "op": "revert" + } + ], + "post_state_root": "0xd0a7878d6a4eda4a0e685ccfc7d5aa733a0dd0d6a1d51e286d88e2d4f685daa2", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x07ad118d6cc8642c86c03827f276d8b791a65e5c99a3845faf186be720a1455d", + "full_shard_key": 1, + "exists": true, + "balances": {} + } + } + }, + { + "name": "revert_after_del_account", + "comment": "reverting del_account leaves the trie untouched: unwinding its six steps ends at the touched flag set_nonce journaled, which was False, so commit skips the account rather than rewriting the leaf it would otherwise have drained (a selfdestruct in a reverted frame)", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "5" + }, + "code": "0x6000", + "storage": { + "0x01": "0x2a" + } + } + }, + "pre_state_root": "0xb2ce28359258d602406c5269c14731b1f2ac4b429d61ffe4ded0633d25b28dab", + "ops": [ + { + "op": "snapshot" + }, + { + "op": "del_account", + "address": "aaaa0000000000000000000000000000000000aa" + }, + { + "op": "revert" + } + ], + "post_state_root": "0xb2ce28359258d602406c5269c14731b1f2ac4b429d61ffe4ded0633d25b28dab", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x07ad118d6cc8642c86c03827f276d8b791a65e5c99a3845faf186be720a1455d", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "5" + }, + "storage": { + "0x01": "0x2a" + } + } + } + }, + { + "name": "revert_of_balance_leaves_zero_entry", + "comment": "TokenBalances.set_balance journals the undo as _balances[token_id] = preval (state.py:166), which writes the key back rather than deleting it. Reverting the only credit an account ever received therefore leaves it holding zero rather than holding nothing, and the leaf is 00c0 instead of empty bytes. The nonce is bumped before the snapshot so the account is non-blank and touched for a reason the revert does not unwind", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "bbbb0000000000000000000000000000000000bb00000001": { + "balances": { + "QKC": "5" + } + } + }, + "pre_state_root": "0x8047b149a70785610a21975fd38bf22e3f7ac407588d4a7d0b46f9d63b831393", + "ops": [ + { + "op": "increment_nonce", + "address": "aaaa0000000000000000000000000000000000aa" + }, + { + "op": "snapshot" + }, + { + "op": "delta_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "QKC", + "value": "5" + }, + { + "op": "revert" + } + ], + "post_state_root": "0x6f9c5d08d2750f19dc2a072a03ec145874e90a121b75474468c98dc1813335ee", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "bbbb0000000000000000000000000000000000bb": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "5" + } + } + } + }, + { + "name": "zero_entry_lost_on_read_back", + "comment": "the zero entry lives only in the in-memory map: TokenBalances.__init__ rebuilds _balances from the pair list (state.py:104), which carries no zeros, so an account whose leaf is 00c0 comes back holding nothing and re-serializes to empty bytes. Touching it after the commit boundary without writing a balance is what makes the leaf change on its own", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "5" + } + } + }, + "pre_state_root": "0xe8acdf521ebb6bc4dddd2b01e7fae0c3b736c3f4540c30a631c2e97e9b176b72", + "ops": [ + { + "op": "increment_nonce", + "address": "aaaa0000000000000000000000000000000000aa" + }, + { + "op": "set_token_balance", + "address": "aaaa0000000000000000000000000000000000aa", + "token": "QKC", + "value": "0" + }, + { + "op": "commit" + }, + { + "op": "increment_nonce", + "address": "aaaa0000000000000000000000000000000000aa" + } + ], + "post_state_root": "0xbaec7254a84ce99c853015548c9fdd8f1ee76dfc4b799ead25e2bbb6b4b6cd8e", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 2, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": {} + } + } + }, + { + "name": "committed_storage_reopens", + "comment": "a contract's storage survives a commit boundary: the second commit reads the slots back through the trie", + "network": "devnet", + "full_shard_id": 1, + "pre_alloc": { + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": { + "QKC": "5" + }, + "code": "0x6000" + } + }, + "pre_state_root": "0x51f9e0b983d418c7cf59d0d24f17f99b552ab943f02152d0b94962206f992399", + "ops": [ + { + "op": "set_storage", + "address": "aaaa0000000000000000000000000000000000aa", + "key": "0x01", + "value": "0x2a" + }, + { + "op": "commit" + }, + { + "op": "set_storage", + "address": "aaaa0000000000000000000000000000000000aa", + "key": "0x02", + "value": "0x2b" + } + ], + "post_state_root": "0x7f9a01e748017171f1fe105c56bfa5af6880b496a81cc88b338bfeaf86acc093", + "accounts": { + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x07ad118d6cc8642c86c03827f276d8b791a65e5c99a3845faf186be720a1455d", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "5" + }, + "storage": { + "0x01": "0x2a", + "0x02": "0x2b" + } + } + } + } + ] +} From bba7731501d408a957f3e0a601276449a3790f1e Mon Sep 17 00:00:00 2001 From: syntrust Date: Tue, 25 Aug 2026 17:35:50 +0800 Subject: [PATCH 3/4] add log --- qkc/testdata/gen_exec_golden.py | 40 +++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/qkc/testdata/gen_exec_golden.py b/qkc/testdata/gen_exec_golden.py index 3558eaa5473..37566dd7e62 100644 --- a/qkc/testdata/gen_exec_golden.py +++ b/qkc/testdata/gen_exec_golden.py @@ -25,7 +25,9 @@ python /qkc/testdata/gen_exec_golden.py The pyquarkchain checkout is taken from $PYQUARKCHAIN, defaulting to the -current directory. +current directory. --log-level raises pyquarkchain's own logging while +the vectors are built; --allow-dirty records uncommitted oracle edits instead +of refusing to run. """ import asyncio @@ -42,6 +44,34 @@ _PYQUARKCHAIN = os.path.abspath(os.environ.get("PYQUARKCHAIN", os.getcwd())) _ALLOW_DIRTY = "--allow-dirty" in sys.argv +_LOG_LEVELS = ("debug", "info", "warning", "error", "critical") + + +def parse_log_level(): + """Read --log-level from argv, defaulting to what pyquarkchain falls back to. + + Nothing here reads a pyquarkchain log, so the level cannot reach the + vectors; raising it only exposes what the oracle is doing while it runs. + """ + for i, arg in enumerate(sys.argv): + if arg.startswith("--log-level="): + value = arg.split("=", 1)[1] + elif arg == "--log-level": + value = sys.argv[i + 1] if i + 1 < len(sys.argv) else "" + else: + continue + if value.lower() not in _LOG_LEVELS: + sys.exit( + "--log-level takes one of {}, got {!r}".format( + ", ".join(_LOG_LEVELS), value + ) + ) + return value.lower() + return "warning" + + +_LOG_LEVEL = parse_log_level() + # The modules that decide what these vectors say. Their digests go into the # output so a vector can be traced back to the exact source that produced it: # the genesis self-check cannot do that job, since changing execution semantics @@ -90,13 +120,19 @@ from quarkchain.evm.transactions import Transaction as EvmTransaction from quarkchain.evm.utils import privtoaddr from quarkchain.genesis import GenesisManager - from quarkchain.utils import token_id_encode + from quarkchain.utils import Logger, token_id_encode except ImportError as exc: # pragma: no cover - operator feedback only sys.exit( "cannot import quarkchain ({}); run from a pyquarkchain checkout or set " "PYQUARKCHAIN to one, inside a virtualenv with its requirements".format(exc) ) +# pyquarkchain latches its log level on the first Logger call and then refuses +# to change it (utils.py:133-135), so this has to run before anything below +# reaches the oracle. Setting it explicitly also silences the warning that the +# latch emits when it has to pick the level itself. +Logger.set_logging_level(_LOG_LEVEL) + # --------------------------------------------------------------------------- # helpers From 4b814d89382f23920ad15e90d971c9328463069a Mon Sep 17 00:00:00 2001 From: syntrust Date: Tue, 1 Sep 2026 10:23:52 +0800 Subject: [PATCH 4/4] update case of create2 --- qkc/testdata/exec_golden/block_level.json | 3 +- qkc/testdata/exec_golden/message_level.json | 380 ++++++++++++++++++-- qkc/testdata/exec_golden/state_level.json | 3 +- qkc/testdata/gen_exec_golden.py | 137 +++++-- 4 files changed, 462 insertions(+), 61 deletions(-) diff --git a/qkc/testdata/exec_golden/block_level.json b/qkc/testdata/exec_golden/block_level.json index 82fb0bc5b52..b420a22b8e1 100644 --- a/qkc/testdata/exec_golden/block_level.json +++ b/qkc/testdata/exec_golden/block_level.json @@ -9,13 +9,14 @@ "root by applying it and nothing else." ], "source": { - "pyquarkchain_commit": "75f8d7e166df0f5a2579ffe37ea7b4f5ba79db60", + "pyquarkchain_commit": "bf860bf8351df80fbebc22919d516050f03ae900", "dirty_modules": [], "module_digests": { "quarkchain/evm/messages.py": "7d6cb97202b0e5e7", "quarkchain/evm/state.py": "de5216e6c10e606e", "quarkchain/evm/transactions.py": "573f578989e912a1", "quarkchain/evm/specials.py": "c14638312c952401", + "quarkchain/evm/vm.py": "90eadc5ac812eb1f", "quarkchain/evm/opcodes.py": "40d1eaab9bb6612a", "quarkchain/cluster/shard_state.py": "9cc7a3ff57b383b5", "quarkchain/core.py": "3f6d1865eb449b80", diff --git a/qkc/testdata/exec_golden/message_level.json b/qkc/testdata/exec_golden/message_level.json index 5bea6196b41..57349f4b8cc 100644 --- a/qkc/testdata/exec_golden/message_level.json +++ b/qkc/testdata/exec_golden/message_level.json @@ -6,13 +6,14 @@ "declares whether it pins a successful execution or a rejection." ], "source": { - "pyquarkchain_commit": "75f8d7e166df0f5a2579ffe37ea7b4f5ba79db60", + "pyquarkchain_commit": "bf860bf8351df80fbebc22919d516050f03ae900", "dirty_modules": [], "module_digests": { "quarkchain/evm/messages.py": "7d6cb97202b0e5e7", "quarkchain/evm/state.py": "de5216e6c10e606e", "quarkchain/evm/transactions.py": "573f578989e912a1", "quarkchain/evm/specials.py": "c14638312c952401", + "quarkchain/evm/vm.py": "90eadc5ac812eb1f", "quarkchain/evm/opcodes.py": "40d1eaab9bb6612a", "quarkchain/cluster/shard_state.py": "9cc7a3ff57b383b5", "quarkchain/core.py": "3f6d1865eb449b80", @@ -2147,11 +2148,11 @@ } }, { - "name": "create2_word_gas_underflows", - "comment": "CREATE2's per-word charge is subtracted unchecked and the memory it is charged for needs no growing, so the frame carries a negative gas counter past the point anything would notice it; with CREATE2 last, the frame hands that counter back and apply_transaction trips its own `assert gas_remained >= 0` (messages.py:305). The transaction is not refused for a reason -- pyquarkchain cannot process it at all, so no block containing it exists", + "name": "create2_word_gas_oog_without_growing", + "comment": "CREATE2's per-word charge over memory that needs no growing: mem_extend has nothing to grow and so checks nothing, which leaves the check the charge carries (vm.py:695) as the only thing between the frame and a negative gas counter. It refuses, so the frame is an ordinary out-of-gas: failed receipt, the whole limit spent, the fee in the coinbase", "network": "devnet", "full_shard_id": 1, - "expect": "rejected", + "expect": "success", "context": { "timestamp": 1, "gas_limit": 12000000, @@ -2176,7 +2177,7 @@ "transaction": { "nonce": 0, "gas_price": "1", - "start_gas": 53500, + "start_gas": 53700, "to": "0xaaaa0000000000000000000000000000000000aa", "value": "0", "data": "0x", @@ -2186,25 +2187,35 @@ "gas_token_id": 35760, "transfer_token_id": 35760, "version": 0, - "v": "27", - "r": "597902601262657265624722210580897406987520543669649996700362526082170247999", - "s": "2777299912825643025837406676573787197657175596000636441731879062431711095029", + "v": "28", + "r": "40218412579742764606930556988143045674492478144583474886583865993533047047600", + "s": "31557536946104663492006276604022693423729777611841015951953706588560080122014", "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", - "hash": "0x80cee19476dd4871dea33b8c9ef56a30dd9a3009f357f8faf6a55469bae5ad41" + "hash": "0x249d9695334a1de388c0592f5feb3e479495803ada310a8da87d663872a0c6d0" } } ], "gas_used_start": 0, "result": { - "rejected": true, - "error_type": "AssertionError", - "error": "" + "success": false, + "output": "0x" }, - "post_state_root": "0xfcc68a8310cd1ed9846443526d2d946263674d0b2baf51306221bca8425ccc10", - "gas_used": 0, + "post_state_root": "0x2d1391178ec5ca809553ec695f669487ab64c135346c3d2fe86cda3b8de44a13", + "gas_used": 53700, "xshard_receive_gas_used": 0, - "block_fee_tokens": {}, - "receipts": [], + "block_fee_tokens": { + "35760": "26850" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 53700, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], "xshard_deposit_receipts": [], "xshard_list": [], "accounts": { @@ -2214,11 +2225,11 @@ "full_shard_key": 1, "exists": true, "balances": { - "35760": "999999999999946500" + "35760": "999999999999946300" } }, "aaaa0000000000000000000000000000000000aa": { - "nonce": 2, + "nonce": 1, "code_hash": "0xe85e9496874f0de902ba2d17fc8c7a7c2178e3e7c53fcd3c585bec4ef7c2aaab", "full_shard_key": 1, "exists": true, @@ -2228,8 +2239,10 @@ "nonce": 0, "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", "full_shard_key": 1, - "exists": false, - "balances": {} + "exists": true, + "balances": { + "35760": "26850" + } } } }, @@ -2334,7 +2347,7 @@ }, { "name": "create2_word_gas_oog_while_growing", - "comment": "the same shortfall with the memory still to grow: mem_extend checks before it spends, so both sides simply run out of gas and the transaction is processed with a failed receipt. This is the case that keeps the boundary above from swallowing an ordinary out-of-gas and abandoning a block that is fine", + "comment": "the same shortfall with the memory still to grow, which clears the word charge and is refused by mem_extend instead. The pair is worth keeping because the two checks are reached by different code and have to agree on the answer", "network": "devnet", "full_shard_id": 1, "expect": "success", @@ -2362,7 +2375,7 @@ "transaction": { "nonce": 0, "gas_price": "1", - "start_gas": 53500, + "start_gas": 53700, "to": "0xaaaa0000000000000000000000000000000000aa", "value": "0", "data": "0x", @@ -2372,11 +2385,11 @@ "gas_token_id": 35760, "transfer_token_id": 35760, "version": 0, - "v": "27", - "r": "597902601262657265624722210580897406987520543669649996700362526082170247999", - "s": "2777299912825643025837406676573787197657175596000636441731879062431711095029", + "v": "28", + "r": "40218412579742764606930556988143045674492478144583474886583865993533047047600", + "s": "31557536946104663492006276604022693423729777611841015951953706588560080122014", "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", - "hash": "0x80cee19476dd4871dea33b8c9ef56a30dd9a3009f357f8faf6a55469bae5ad41" + "hash": "0x249d9695334a1de388c0592f5feb3e479495803ada310a8da87d663872a0c6d0" } } ], @@ -2385,16 +2398,16 @@ "success": false, "output": "0x" }, - "post_state_root": "0x3b42015ae04ec705566c463aea1f8ec7f8e2e43dfcafe3b3d7db0090d25e9b35", - "gas_used": 53500, + "post_state_root": "0xc49643aff49ab9c8a3b214bf8967ba5ac20da32f6c42267af81b35ccba421e74", + "gas_used": 53700, "xshard_receive_gas_used": 0, "block_fee_tokens": { - "35760": "26750" + "35760": "26850" }, "receipts": [ { "success": false, - "cumulative_gas_used": 53500, + "cumulative_gas_used": 53700, "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "contract_address": "0x", "contract_full_shard_key": 1, @@ -2410,7 +2423,7 @@ "full_shard_key": 1, "exists": true, "balances": { - "35760": "999999999999946500" + "35760": "999999999999946300" } }, "aaaa0000000000000000000000000000000000aa": { @@ -2426,7 +2439,310 @@ "full_shard_key": 1, "exists": true, "balances": { - "35760": "26750" + "35760": "26850" + } + } + } + }, + { + "name": "log_byte_gas_oog_without_growing", + "comment": "the same boundary on the other fee: LOG0's per-byte charge over memory that needs no growing, where the check the charge carries (vm.py:675) is the only thing between the frame and a negative gas counter. It refuses, so the frame is an ordinary out-of-gas: failed receipt, no log, the whole limit spent", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x60006101e0526102006000a0" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 25500, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "26188436340973416912773074672774267441913166088073261541710909355367547351316", + "s": "49046010314666837038394641130607236086850944873683011938439713119809583619933", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x0a816d2504e33a4ebbd9660421a3f7bed7b27677c91041b86367699464330b93" + } + } + ], + "gas_used_start": 0, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0x608238441dd0032ee5b756a1e47c1433dfd9702a81cfb91650e4312925e9c33a", + "gas_used": 25500, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "12750" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 25500, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999974500" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0xaeb9690786437c210e9a71c838ee6101ed4c484ec4515e148281d8002938175e", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "12750" + } + } + } + }, + { + "name": "log_byte_gas_covered", + "comment": "the same code with the byte charge paid for: the log goes out with all 512 zero bytes of it, and the receipt carries the bloom of an address with no topics", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x60006101e0526102006000a0" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 26000, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "27", + "r": "14419709670409496279019973247488419195527304847111918631917398223720169042631", + "s": "10053120619107158353592859133004124275529900419099234271363009055517307456903", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x02b865bd7f82441f7cdd284844bb08bf8e856de209b296e95d3711c79ee9f733" + } + } + ], + "gas_used_start": 0, + "result": { + "success": true, + "output": "0x" + }, + "post_state_root": "0x22cb0b39d9cd51b0fc559b21b07911ba07be5acf73b03f93cbadfbca161bb895", + "gas_used": 25534, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "12767" + }, + "receipts": [ + { + "success": true, + "cumulative_gas_used": 25534, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [ + { + "address": "0xaaaa0000000000000000000000000000000000aa", + "topics": [], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999974466" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0xaeb9690786437c210e9a71c838ee6101ed4c484ec4515e148281d8002938175e", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "12767" + } + } + } + }, + { + "name": "log_byte_gas_oog_while_growing", + "comment": "the same shortfall with the memory still to grow, which clears the byte charge and is refused by mem_extend instead. The pair is worth keeping for the same reason as the CREATE2 one", + "network": "devnet", + "full_shard_id": 1, + "expect": "success", + "context": { + "timestamp": 1, + "gas_limit": 12000000, + "block_number": 1, + "block_coinbase": "0xcccc0000000000000000000000000000000000cc", + "block_difficulty": 1 + }, + "pre_alloc": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a00000001": { + "balances": { + "QKC": "1000000000000000000" + } + }, + "aaaa0000000000000000000000000000000000aa00000001": { + "balances": {}, + "code": "0x6102006000a0" + } + }, + "inputs": [ + { + "kind": "transaction", + "transaction": { + "nonce": 0, + "gas_price": "1", + "start_gas": 25500, + "to": "0xaaaa0000000000000000000000000000000000aa", + "value": "0", + "data": "0x", + "network_id": 255, + "from_full_shard_key": 1, + "to_full_shard_key": 1, + "gas_token_id": 35760, + "transfer_token_id": 35760, + "version": 0, + "v": "28", + "r": "26188436340973416912773074672774267441913166088073261541710909355367547351316", + "s": "49046010314666837038394641130607236086850944873683011938439713119809583619933", + "sender": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a", + "hash": "0x0a816d2504e33a4ebbd9660421a3f7bed7b27677c91041b86367699464330b93" + } + } + ], + "gas_used_start": 0, + "result": { + "success": false, + "output": "0x" + }, + "post_state_root": "0xc4daedc5ecd37f15d0f210ad00118fcdd8fd5c449a05ef9d330cb9ca1e6676f0", + "gas_used": 25500, + "xshard_receive_gas_used": 0, + "block_fee_tokens": { + "35760": "12750" + }, + "receipts": [ + { + "success": false, + "cumulative_gas_used": 25500, + "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "contract_address": "0x", + "contract_full_shard_key": 1, + "logs": [] + } + ], + "xshard_deposit_receipts": [], + "xshard_list": [], + "accounts": { + "19e7e376e7c213b7e7e7e46cc70a5dd086daff2a": { + "nonce": 1, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "999999999999974500" + } + }, + "aaaa0000000000000000000000000000000000aa": { + "nonce": 1, + "code_hash": "0x14ad58f39b01bfc8532070b0384f8340d236ac3f00d10f7e60a82024b52db7ee", + "full_shard_key": 1, + "exists": true, + "balances": {} + }, + "cccc0000000000000000000000000000000000cc": { + "nonce": 0, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "full_shard_key": 1, + "exists": true, + "balances": { + "35760": "12750" } } } diff --git a/qkc/testdata/exec_golden/state_level.json b/qkc/testdata/exec_golden/state_level.json index 76ff45a5b37..e3e388fee3d 100644 --- a/qkc/testdata/exec_golden/state_level.json +++ b/qkc/testdata/exec_golden/state_level.json @@ -7,13 +7,14 @@ "operations start from a state that has been through the trie." ], "source": { - "pyquarkchain_commit": "75f8d7e166df0f5a2579ffe37ea7b4f5ba79db60", + "pyquarkchain_commit": "bf860bf8351df80fbebc22919d516050f03ae900", "dirty_modules": [], "module_digests": { "quarkchain/evm/messages.py": "7d6cb97202b0e5e7", "quarkchain/evm/state.py": "de5216e6c10e606e", "quarkchain/evm/transactions.py": "573f578989e912a1", "quarkchain/evm/specials.py": "c14638312c952401", + "quarkchain/evm/vm.py": "90eadc5ac812eb1f", "quarkchain/evm/opcodes.py": "40d1eaab9bb6612a", "quarkchain/cluster/shard_state.py": "9cc7a3ff57b383b5", "quarkchain/core.py": "3f6d1865eb449b80", diff --git a/qkc/testdata/gen_exec_golden.py b/qkc/testdata/gen_exec_golden.py index 37566dd7e62..082751a79e5 100644 --- a/qkc/testdata/gen_exec_golden.py +++ b/qkc/testdata/gen_exec_golden.py @@ -81,6 +81,7 @@ def parse_log_level(): "quarkchain/evm/state.py", "quarkchain/evm/transactions.py", "quarkchain/evm/specials.py", + "quarkchain/evm/vm.py", "quarkchain/evm/opcodes.py", "quarkchain/cluster/shard_state.py", "quarkchain/core.py", @@ -913,19 +914,34 @@ def execute(): # # It is built to sit on the boundary the word charge creates. Up to and # including CREATE2's 32000 the frame spends 32327; the 6-per-word charge on -# top is 576 more. pyquarkchain subtracts that charge without checking -# (vm.py:689) and mem_extend only checks when it has to grow, so a frame given -# less than 32903 goes negative there rather than running out. Placing CREATE2 -# last is what makes the difference observable: the main loop's `gas < 0` test -# is at the top of the next iteration, which never comes. +# top is 576 more. The charge carries its own `gas < 0` test (vm.py:695), and +# for a frame given less than 32903 that test is the only one it meets: +# mem_extend has nothing to grow and so checks nothing, and the main loop's +# own test sits at the top of the next iteration, which -- with CREATE2 last +# -- never comes. CREATE2_WORD_GAS_RUNTIME = "0x6000610be0526000610c0060006000f5" # The same CREATE2 without the mstore in front, so the memory still has to grow. -# mem_extend then does check what it is about to spend, which makes an -# underfunded frame a plain out-of-gas on both sides -- the case that says a -# consumer must not mistake every short CREATE2 for the boundary above. +# The word charge is taken first either way; growing costs 306 more right after +# it, so a frame short by less than that clears the charge and is refused by +# mem_extend instead. Same answer, one check further on. CREATE2_GROW_RUNTIME = "0x6000610c0060006000f5" +# LOG_BYTE_GAS_RUNTIME is the same boundary one opcode over: it expands memory +# to exactly 512 bytes and then logs all of it, as the last instruction. +# +# mstore(0x01e0, 0) expand to ceil32(0x01e0 + 32) = 512 bytes = 16 words +# log0(0, 0x0200) 512 bytes of data, no further expansion +# +# Up to and including LOG0's 375 the frame spends 438; the 8-per-byte charge on +# top is 4096 more. That charge carries its own `gas < 0` test (vm.py:675), and +# for a frame given less than 4534 that test is the only one it meets, for the +# two reasons above: nothing to grow, and no next iteration. +LOG_BYTE_GAS_RUNTIME = "0x60006101e0526102006000a0" + +# The same log without the mstore in front, so the memory still has to grow. +LOG_GROW_RUNTIME = "0x6102006000a0" + def general_native_token_runtime(): """The manager's deployed code, taken out of its deployment bytecode. @@ -1590,15 +1606,14 @@ def message_cases(): }, }, { - "name": "create2_word_gas_underflows", - "expect": "rejected", - "comment": "CREATE2's per-word charge is subtracted unchecked and the " - "memory it is charged for needs no growing, so the frame carries a " - "negative gas counter past the point anything would notice it; with " - "CREATE2 last, the frame hands that counter back and apply_transaction " - "trips its own `assert gas_remained >= 0` (messages.py:305). The " - "transaction is not refused for a reason -- pyquarkchain cannot " - "process it at all, so no block containing it exists", + "name": "create2_word_gas_oog_without_growing", + "expect": "success", + "comment": "CREATE2's per-word charge over memory that needs no " + "growing: mem_extend has nothing to grow and so checks nothing, " + "which leaves the check the charge carries (vm.py:695) as the only " + "thing between the frame and a negative gas counter. It refuses, so " + "the frame is an ordinary out-of-gas: failed receipt, the whole " + "limit spent, the fee in the coinbase", "network": "devnet", "timestamp": 1, "pre_alloc": { @@ -1608,9 +1623,9 @@ def message_cases(): "tx": { "nonce": 0, "gas_price": 1, - # 21000 intrinsic + 32500 for the frame: past CREATE2's 32000 but - # 403 short of the word charge. - "start_gas": 53500, + # 21000 intrinsic + 32700 for the frame: past CREATE2's 32000 but + # 203 short of the word charge. + "start_gas": 53700, "to": A, "value": 0, "signer": "A", @@ -1641,11 +1656,10 @@ def message_cases(): { "name": "create2_word_gas_oog_while_growing", "expect": "success", - "comment": "the same shortfall with the memory still to grow: " - "mem_extend checks before it spends, so both sides simply run out of " - "gas and the transaction is processed with a failed receipt. This is " - "the case that keeps the boundary above from swallowing an ordinary " - "out-of-gas and abandoning a block that is fine", + "comment": "the same shortfall with the memory still to grow, " + "which clears the word charge and is refused by mem_extend instead. " + "The pair is worth keeping because the two checks are reached by " + "different code and have to agree on the answer", "network": "devnet", "timestamp": 1, "pre_alloc": { @@ -1655,8 +1669,77 @@ def message_cases(): "tx": { "nonce": 0, "gas_price": 1, - # 21000 intrinsic + 32500 for the frame, against 32894 needed. - "start_gas": 53500, + # 21000 intrinsic + 32700 for the frame, against 32894 needed. + "start_gas": 53700, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "log_byte_gas_oog_without_growing", + "expect": "success", + "comment": "the same boundary on the other fee: LOG0's per-byte " + "charge over memory that needs no growing, where the check the " + "charge carries (vm.py:675) is the only thing between the frame and " + "a negative gas counter. It refuses, so the frame is an ordinary " + "out-of-gas: failed receipt, no log, the whole limit spent", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": LOG_BYTE_GAS_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + # 21000 intrinsic + 4500 for the frame: past LOG0's 375 but 34 + # short of the byte charge. + "start_gas": 25500, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "log_byte_gas_covered", + "expect": "success", + "comment": "the same code with the byte charge paid for: the log " + "goes out with all 512 zero bytes of it, and the receipt carries " + "the bloom of an address with no topics", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": LOG_BYTE_GAS_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + # 21000 intrinsic + 5000 for the frame: 466 left after the charge. + "start_gas": 26000, + "to": A, + "value": 0, + "signer": "A", + }, + }, + { + "name": "log_byte_gas_oog_while_growing", + "expect": "success", + "comment": "the same shortfall with the memory still to grow, " + "which clears the byte charge and is refused by mem_extend instead. " + "The pair is worth keeping for the same reason as the CREATE2 one", + "network": "devnet", + "timestamp": 1, + "pre_alloc": { + SENDER_A + "00000001": funded, + A + "00000001": {"balances": {}, "code": LOG_GROW_RUNTIME}, + }, + "tx": { + "nonce": 0, + "gas_price": 1, + # 21000 intrinsic + 4500 for the frame, against 4525 needed. + "start_gas": 25500, "to": A, "value": 0, "signer": "A",