Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ac5a4c3

Browse files
eshaan7aashutoshrathi
andauthoredSep 23, 2024
update for sdk v0.6.0, use bun (#48)
* update docs for v0.5.5 * update docs for v0.5.5 * update for v0.6.0, add back bun * chore: minor fixes --------- Co-authored-by: Aashutosh Rathi <[email protected]>
1 parent 8a8cc6d commit ac5a4c3

23 files changed

+661
-584
lines changed
 

‎docs/pages/build/changelog.mdx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
# Changelog [What's new]
22

3+
## v0.6.0
4+
5+
#### Breaking changes
6+
7+
> See [upgrade guide](/build/upgrade-guide).
8+
9+
- Add new `State.STF` and `State.Hook` static methods to define STFs and Hooks.
10+
- Remove `ActionSchema`. Input schemas are now [defined directly inside the STFs](/build/framework/state-machine/state-transitions#passing-inputs-to-an-stf).
11+
- Action signatures are now enforced over both STF name and inputs, as opposed to inputs only earlier.
12+
13+
#### Bug Fixes
14+
15+
- Fix a bug where if a custom sequencer strategy were to discard actions, they would get removed from the action pool. Such discarded actions, if any, are now re-enqueued to the front of the action pool.
16+
17+
#### Improvements
18+
19+
- Add `sdkVersion` field to [`ExternalConfig`](/build/framework/config#accessing-config-values).
20+
- Expose [`ChainData`](/build/framework/type-definitions#chaindata) in [`getOrderedActions`](/build/framework/sequencer#custom-ordering-strategy) method of a sequencer strategy for increased context.
21+
22+
#### Other changes
23+
24+
- Updates in [CLI](https://www.npmjs.com/package/@stackr/cli) `v0.1.8`, [ESLint Plugin](https://www.npmjs.com/package/@stackr/eslint-plugin) `v0.1.2` and Playground for the above breaking changes. (Use latest for both for compatibility)
25+
326
## v0.5.5
427

528
#### Breaking changes
629

7-
- The [`getOrderedActions`](/build/framework/sequencer#custom-ordering-strategy) method of a sequencer strategy now accepts a list of actions
8-
as a `Readonly<AcknowledgedAction[]>` type and is supposed only to return the ordered list of action hashes as opposed to `Action` objects earlier.
30+
- The [`getOrderedActions`](/build/framework/sequencer#custom-ordering-strategy) method of a sequencer strategy now accepts a list of actions
31+
as a `Readonly<AcknowledgedAction[]>` type and is supposed only to return the ordered list of action hashes as opposed to `Action` objects earlier.
932

1033
#### Bug Fixes
1134

‎docs/pages/build/cli/init.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ The project directory will look something like this depending on the template -
4545
│ ├── stackr
4646
│ │ ├── machine.ts
4747
│ │ ├── mru.ts
48-
│ │ ├── schemas.ts
4948
│ │ ├── state.ts
5049
│ │ └── transitions.ts
5150
│ ├── index.ts

‎docs/pages/build/faq.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ They've fixed the issue in `v1.1.28` and you can upgrade by running:
2626
bun upgrade
2727
bun --version # check that you are on version >= 1.1.28
2828
```
29-
30-
However, moving forward we recommend using `tsx` over `bun run` for running the MRU server. You may still use Bun for package management.
31-
3229
:::
3330

3431
If you have any more questions, please reach out to us on our [Discord](https://discord.stackrlabs.xyz/) server.

‎docs/pages/build/framework/action/action-schema.mdx

Lines changed: 0 additions & 149 deletions
This file was deleted.

‎docs/pages/build/framework/action/introduction.mdx

Lines changed: 10 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -28,72 +28,30 @@ However, Micro-Rollup developers are free to design their actions to include a c
2828
In a gist, an action has the following properties to be able to mutate a state machine:
2929

3030
```typescript
31-
export interface IAction {
32-
identifier: string;
33-
msgSender: AddressLike;
34-
signature: SignatureLike;
35-
payload: AllowedInputTypes;
31+
interface IAction {
32+
name: string;
33+
msgSender: string;
34+
signature: string;
35+
inputs: AllowedInputTypes;
3636
}
3737
```
3838

39-
- `identifier`: A unique identifier for the action. This allows the state machine to redirect it to the correct state transition function.
39+
- `name`: Name of the state transition function.
4040
- `msgSender`: The address of the user who sent the action.
4141
- `signature`: The signature of the action. This is used to authenticate the user who signed the action.
42-
- `payload`: The data of the action. This is the actual data that the action is supposed to mutate the state with.
42+
- `inputs`: The user-provided payload of the action. This is the actual data that the action is supposed to mutate the state with.
4343

44-
## Action Creation
44+
## Action Creation & Submission
4545

46-
Actions are constructed via `ActionSchema`s. More on this [here](/build/framework/action/action-schema).
47-
48-
Once you've generated the schema for your action, you can use the `actionFrom` function on your schema to create a new action.
49-
The schema ensures that your action is well-formed and adheres to the schema's rules while also being EIP 712 'signable'.
50-
Here's an example of how you can create an action from a schema:
51-
52-
```typescript
53-
const action = NewSchema.actionFrom({
54-
inputs,
55-
signature,
56-
msgSender: wallet.address,
57-
});
58-
```
59-
60-
- The `inputs` are of whatever type you defined in your schema.
61-
- The `signature` is an EIP712 signature over the action's `inputs`. This is used to authenticate the user who signed the action.
62-
It can be created using your action schema like this:
63-
64-
```typescript
65-
const signature = await wallet.signTypedData(
66-
schema.domain,
67-
schema.EIP712TypedData.types,
68-
payload
69-
);
70-
```
71-
72-
- The `msgSender` is the address of the user who sent the action.
73-
74-
Your action is now ready for submission!
75-
76-
## Action Submission
77-
78-
Your action can now be submitted to the Micro-Rollup's State Machine.
79-
All this requires calling the `submitAction` function on your Micro-Rollup.
80-
81-
```typescript
82-
let ack = await rollup.submitAction("<REDUCER-NAME>", action);
83-
```
84-
85-
We also pass in the name of the reducer that will be handling your action.
86-
These are state transition functions that you will be defining in the `src/stackr/transitions.ts` file.
87-
On succesful submission, you will recieve an `Acknowledment` object that acts like a transaction receipt and is also considered a `C0` confirmation.
88-
This is proof of the action being successfully submitted to the state machine.
46+
This is covered as part of the [Counter Rollup Tutorial](/build/guides/tutorials/counter#interacting-with-the-rollup).
8947

9048
:::note
9149
An action's payload size should not exceed ~128kb. This limit is enforced to keep batch size well within the means of different DA layer's maximum supported blob size.
9250
:::
9351

9452
## EIP-712 Signing
9553

96-
EIP 712 is a standard for signing structured data. It is used to sign actions in this version of Stackr.
54+
[EIP-712](https://eips.ethereum.org/EIPS/eip-712) is a standard for signing structured data. It is used to sign actions in this version of Stackr.
9755
This also makes Stackr Actions compatible with existing browser wallet extensions and other EVM-friendly wallet implementations.
9856

9957
## Action Execution

‎docs/pages/build/framework/action/serialized-action.mdx

Lines changed: 0 additions & 69 deletions
This file was deleted.

‎docs/pages/build/framework/config.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,6 @@ type ExternalConfig = {
181181
preferredDA: DA;
182182
accounts: PublicAccount[];
183183
logLevel: LogLevel;
184+
sdkVersion: string;
184185
};
185186
```

‎docs/pages/build/framework/events.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { ConfirmationEvents } from "@stackr/sdk";
1212

1313
const rollup = await MicroRollup({
1414
config: stackrConfig,
15-
actionSchemas: [UpdateCounterSchema],
1615
stateMachines: [machine],
1716
});
1817

@@ -117,6 +116,8 @@ Occurs when an action is picked by the sequencer.
117116
**Event Arguments:** `SequencerPickActionEventArgs`
118117

119118
- `actionHash`: Hash of the action picked.
119+
- `blockParentHash`: Hash of the parent block.
120+
- `blockHeight`: Current block height.
120121

121122
### `SequencerEvents.ORDER_ACTIONS`
122123

@@ -127,6 +128,8 @@ Triggered when actions are ordered by the sequencer.
127128
- `actionHashes`: List of action hashes ordered.
128129
- `actionRootHash`: Root hash of the ordered actions.
129130
- `signature`: Signature verifying the order.
131+
- `blockParentHash`: Hash of the parent block.
132+
- `blockHeight`: Current block height.
130133

131134
### `SequencerEvents.PROPOSE_BLOCK`
132135

0 commit comments

Comments
 (0)
Please sign in to comment.