diff --git a/README.md b/README.md index 8e88d07c7..94184b9f2 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ tezos-setup You can also read [the dedicated article](./docs/baking.md) to find out more about this setup, the binaries, and the services used. -For setting up experimental transaction rollup node, see [this doc](./docs/tx-rollup.md). +For setting up experimental smart rollup node, see [this doc](./docs/smart-rollup.md). #### Voting on Ubuntu diff --git a/docker/package/defaults/tezos-rollup-node.conf b/docker/package/defaults/tezos-rollup-node.conf old mode 100644 new mode 100755 index eb34b28ed..ac8ded482 --- a/docker/package/defaults/tezos-rollup-node.conf +++ b/docker/package/defaults/tezos-rollup-node.conf @@ -4,8 +4,8 @@ # shellcheck disable=SC2034 TEZOS_CLIENT_DIR="/var/lib/tezos/.tezos-client" -NODE_RPC_SCHEME="http" -NODE_RPC_ADDR="localhost:8732" -ROLLUP_NODE_RPC_ENDPOINT="127.0.0.1:8472" -ROLLUP_MODE="observer" +NODE_RPC_ENDPOINT="http://localhost:8732" +ROLLUP_MODE="operator" ROLLUP_ALIAS="rollup" +ROLLUP_OPERATORS="baker" +ROLLUP_DATA_DIR="/var/lib/tezos/rollup" diff --git a/docker/package/packages.py b/docker/package/packages.py index 74fdc3919..c9ca8cede 100644 --- a/docker/package/packages.py +++ b/docker/package/packages.py @@ -506,78 +506,74 @@ def mk_node_unit( ) -def mk_rollup_packages(*protos): - def mk_units(proto): - startup_script = f"/usr/bin/tezos-sc-rollup-node-{proto}-start" - service_file = ServiceFile( - Unit(after=["network.target"], description=f"Tezos smart rollup node"), - Service( - environment_files=[f"/etc/default/tezos-smart-rollup-node-{proto}"], - environment=[f"PROTOCOL={proto}", f"TYPE=sc"], - exec_start_pre=[ - "+/usr/bin/setfacl -m u:tezos:rwx /run/systemd/ask-password" - ], - exec_start=startup_script, - exec_stop_post=[ - "+/usr/bin/setfacl -x u:tezos /run/systemd/ask-password" - ], - state_directory="tezos", - user="tezos", - type_="forking", - keyring_mode="shared", - ), - Install(wanted_by=["multi-user.target"]), - ) - return [ - SystemdUnit( - service_file=service_file, - startup_script=startup_script.split("/")[-1], - startup_script_source="tezos-rollup-node-start", - config_file="tezos-rollup-node.conf", - ), - ] +def mk_rollup_node(): + startup_script = f"/usr/bin/tezos-smart-rollup-node-start" + service_file = ServiceFile( + Unit(after=["network.target"], description=f"Tezos smart rollup node"), + Service( + environment_files=[f"/etc/default/tezos-smart-rollup-node"], + exec_start_pre=[ + "+/usr/bin/setfacl -m u:tezos:rwx /run/systemd/ask-password" + ], + exec_start=startup_script, + exec_stop_post=["+/usr/bin/setfacl -x u:tezos /run/systemd/ask-password"], + state_directory="tezos", + user="tezos", + type_="simple", + keyring_mode="shared", + ), + Install(wanted_by=["multi-user.target"]), + ) + systemd_units = [ + SystemdUnit( + service_file=service_file, + startup_script=startup_script.split("/")[-1], + startup_script_source="tezos-rollup-node-start", + config_file="tezos-rollup-node.conf", + ), + ] - def mk_rollup_package(name, proto): - proto_snake_case = protocol_numbers[proto] + "_" + proto - return TezosBinaryPackage( - f"tezos-smart-rollup-{name}-{proto}", - f"Tezos smart rollup {name} using {proto}", + return { + f"tezos-smart-rollup-node": TezosBinaryPackage( + f"tezos-smart-rollup-node", + f"Tezos smart rollup node", meta=packages_meta, - systemd_units=mk_units(proto) if name == "node" else [], - target_proto=proto, + systemd_units=systemd_units, additional_native_deps=[ "tezos-client", "tezos-node", "tezos-sapling-params", ], postinst_steps=daemon_postinst_common, - dune_filepath=f"src/proto_{proto_snake_case}/bin_sc_rollup_{name}/main_sc_rollup_{name}_{proto_snake_case}.exe", + dune_filepath="src/bin_smart_rollup_node/main_smart_rollup_node.exe", ) + } + - def mk_node_package(): +def mk_rollup_clients(*protos): + def mk_rollup_client_package(proto): + proto_snake_case = protocol_numbers[proto] + "_" + proto return TezosBinaryPackage( - f"tezos-smart-rollup-node", - f"Tezos smart rollup node", + f"tezos-smart-rollup-client-{proto}", + f"Tezos smart rollup client using {proto}", meta=packages_meta, - systemd_units=[], + target_proto=proto, additional_native_deps=[ "tezos-client", "tezos-node", "tezos-sapling-params", ], postinst_steps=daemon_postinst_common, - dune_filepath="src/bin_smart_rollup_node/main_smart_rollup_node.exe", + dune_filepath=f"src/proto_{proto_snake_case}/bin_sc_rollup_client/main_sc_rollup_client_{proto_snake_case}.exe", ) - packages = ["client"] - # FIXME with #740 PR return [ - {f"tezos-smart-rollup-{name}-{proto}": mk_rollup_package(name, proto)} - for name in packages + {f"tezos-smart-rollup-client-{proto}": mk_rollup_client_package(proto)} for proto in protos - ] + [{f"tezos-smart-rollup-node": mk_node_package()}] + ] -packages.extend(mk_rollup_packages("PtNairob", "Proxford")) +packages.append(mk_rollup_node()) +packages.extend(mk_rollup_clients("PtNairob", "Proxford")) packages = dict(ChainMap(*packages)) diff --git a/docker/package/scripts/tezos-rollup-node-start b/docker/package/scripts/tezos-rollup-node-start old mode 100644 new mode 100755 index 3274b087e..af37aba11 --- a/docker/package/scripts/tezos-rollup-node-start +++ b/docker/package/scripts/tezos-rollup-node-start @@ -6,13 +6,16 @@ set -euo pipefail # Note: the 'TEZOS_CLIENT_DIR' env var is expected and used by the rollup node -# $PROTOCOL should be defined in the system unit environment -node="/usr/bin/octez-$TYPE-rollup-node-$PROTOCOL" +node="/usr/bin/octez-smart-rollup-node" "$node" init "$ROLLUP_MODE" config \ for "$ROLLUP_ALIAS" \ - --rpc-addr "$ROLLUP_NODE_RPC_ENDPOINT" \ + with operators \ + "$ROLLUP_OPERATORS" \ + --data-dir "$ROLLUP_DATA_DIR" \ --force -"$node" --endpoint "$NODE_RPC_SCHEME://$NODE_RPC_ADDR" \ - run "$ROLLUP_MODE" for "$ROLLUP_ALIAS" & +exec "$node" --endpoint "$NODE_RPC_ENDPOINT" \ + run "$ROLLUP_MODE" for "$ROLLUP_ALIAS" \ + with operators "$ROLLUP_OPERATORS" \ + --data-dir "$ROLLUP_DATA_DIR" diff --git a/docs/configuration.md b/docs/configuration.md index e87435d52..1fbfa3037 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -98,9 +98,11 @@ aware of the change as well. | `PORT` | `tezos-signer-tcp` | Listening TCP port for the signer, e.g. `7732` | `tezos-signer-tcp` | | `TIMEOUT` | `tezos-signer-tcp` | Timeout used by the signer to close client connections (in seconds), e.g. `8` | `tezos-signer-tcp` | | `SOCKET` | `tezos-signer-unix` | Path to the local socket file, e.g. `/var/lib/tezos/.tezos-signer/socket` | `tezos-signer-unix` | -| `TEZOS_CLIENT_DIR` | `tezos-tx-rollup-node-` | Path to the tezos client data directory, e.g. `/var/lib/tezos/.tezos-client` | `tezos-tx-rollup-node-` | -| `NODE_RPC_SCHEME` | `tezos-tx-rollup-node-` | Scheme of the node RPC endpoint, e.g. `http`, `https` | `tezos-tx-rollup-node-` | -| `NODE_RPC_ADDR` | `tezos-tx-rollup-node-` | Address of the node RPC endpoint, e.g. `localhost:8732`, `node.example.org:8732` | `tezos-tx-rollup-node-` | -| `ROLLUP_NODE_RPC_ENDPOINT` | `tezos-tx-rollup-node-` | Address of this rollup node RPC endpoint, e.g. `127.0.0.1:8472` | `tezos-tx-rollup-node-` | -| `ROLLUP_MODE` | `tezos-tx-rollup-node-` | Rollup mode used by this node, e.g. `accuser`, `observer`, `batcher` | `tezos-tx-rollup-node-` | -| `ROLLUP_ALIAS` | `tezos-tx-rollup-node-` | Alias of the address to be used for rollup, e.g. `rollup` | `tezos-tx-rollup-node-` | +| `TEZOS_CLIENT_DIR` | `tezos-smart-rollup-node-` | Path to the tezos client data directory, e.g. `/var/lib/tezos/.tezos-client` | `tezos-smart-rollup-node-` | +| `NODE_RPC_SCHEME` | `tezos-smart-rollup-node-` | Scheme of the node RPC endpoint, e.g. `http`, `https` | `tezos-smart-rollup-node-` | +| `NODE_RPC_ADDR` | `tezos-smart-rollup-node-` | Address of the node RPC endpoint, e.g. `localhost:8732`, `node.example.org:8732` | `tezos-smart-rollup-node-` | +| `ROLLUP_NODE_RPC_ENDPOINT` | `tezos-smart-rollup-node-` | Address of this rollup node RPC endpoint, e.g. `127.0.0.1:8472` | `tezos-smart-rollup-node-` | +| `ROLLUP_MODE` | `tezos-smart-rollup-node-` | Rollup mode used by this node, e.g. `accuser`, `observer`, `batcher` | `tezos-smart-rollup-node-` | +| `ROLLUP_ALIAS` | `tezos-smart-rollup-node-` | Alias of the address to be used for rollup, e.g. `rollup` | `tezos-smart-rollup-node-` | +| `ROLLUP_OPERATORS` | `tezos-smart-rollup-node-` | Operator address or alias for node operations in non-observer modes |`tezos-smart-rollup-node-`| +| `ROLLUP_DATA_DIR`| `tezos-smart-rollup-node-` | Directory to store rollup data | `tezos-smart-rollup-node-` | \ No newline at end of file diff --git a/docs/smart-rollup.md b/docs/smart-rollup.md new file mode 100644 index 000000000..fb7c6c829 --- /dev/null +++ b/docs/smart-rollup.md @@ -0,0 +1,44 @@ + + +# Setting up smart rollup node on Ubuntu + +At first you should originate rollup with the provided alias for some implicit account: +``` +sudo -u tezos tezos-client originate smart rollup from of kind of type with kernel +``` +Here: +* `ROLLUP_ALIAS` - Name for a new smart rollup +* `IMPLICIT_ACCOUNT_ALIAS` - Name of the account originating smart rollup +* `SMART_ROLLUP_KIND` - Kind of proof-generating virtual machine (PVM) +* `ROLLUP_PARAMETER_TYPE` - The interface of smart rollup (with entrypoints and signatures) +* `KERNEL` - The kernel of smart rollup that PVM can interpret + +For more information on smart rollup origination, please check [official documentation](https://tezos.gitlab.io/alpha/smart_rollups.html#origination). + +You can use the following command this way: + +``` +octez-client originate smart rollup "my-rollup" \ + from "bob" \ + of kind wasm_2_0_0 \ + of type unit \ + with kernel "file:kernel.hex" +``` + +For more extended step-by-step example, please proceed to this [tutorial](https://www.marigold.dev/post/originating-a-smart-rollup). + +After that, with the active `tezos-node` service available with the provided uri, run the following command +``` +systemctl start tezos-smart-rollup-node.service +``` + +For further details, see [the upstream documentation on smart rollups](http://tezos.gitlab.io/active/smart_rollups.html). + +## Options and defaults + +As any other `systemd` services ditributed here, rollup binaries have settable +options, see [the dedicated documentation](./configuration.md) to see their +default values and how to change these. diff --git a/docs/tx-rollup.md b/docs/tx-rollup.md deleted file mode 100644 index 018710cd0..000000000 --- a/docs/tx-rollup.md +++ /dev/null @@ -1,25 +0,0 @@ - - -# Setting up transaction rollup node on Ubuntu - -At first you should originate rollup with the provided alias for some implicit account: -``` -sudo -u tezos tezos-client originate tx rollup from -``` - -After that, with the active `tezos-node` service available with the provided uri, run the following command -``` -systemctl start tezos-tx-rollup-node-.service -``` -Note: The `proto` variable can be every active protocol. - -For futher details, see [the upstream documentation on transaction rollups](http://tezos.gitlab.io/active/transaction_rollups.html). - -## Options and defaults - -As any other `systemd` services ditributed here, rollup binaries have settable -options, see [the dedicated documentation](./configuration.md) to see their -default values and how to change these.