2
2
3
3
A likely good structure for the module is
4
4
5
- | -----------| --------| -----------| ---------------------------|
6
- | | | CT_MAX | notes |
7
- | -----------| --------| :---------:| ---------------------------|
8
- | WCP | rows * | <determ.> |
9
- | -----------| --------| :---------:|
5
+ | -----------| --------| -----------| --------------------------------|
6
+ | | | CT_MAX | notes |
7
+ | -----------| --------| :---------:| --------------------------------|
8
+ | WCP | rows * | <determ.> | |
9
+ | | | | This comprises both |
10
+ | | | | . MANDATORY PRECONDITIONS |
11
+ | | | | . VALIDITY CHECK COMPARISONS |
12
+ | -----------| --------| :---------:| --------------------------------|
10
13
| MACRO | row | 0 |
11
- | -----------| --------| :---------:| ---------------------------|
12
- | RLP_UTILS | rows * | <determ.> | |
13
- | | | | processing phase columns: |
14
- | | | | . IS_GLOBAL_PREFIX |
15
- | | | | . IS_CHAIN_ID |
16
- | | | | . IS_ADDRESS |
17
- | | | | . IS_Y_PARITY |
18
- | | | | . IS_R |
19
- | | | | . IS_S |
20
- | -----------| --------| -----------| ---------------------------|
14
+ | -----------| --------| :---------:| --------------------------------|
15
+ | RLP_UTILS | rows * | <determ.> | |
16
+ | | | | processing phase columns: |
17
+ | | | | . IS_MAGIC |
18
+ | | | | . IS_GLOBAL_PREFIX |
19
+ | | | | . IS_CHAIN_ID |
20
+ | | | | . IS_ADDRESS |
21
+ | -----------| --------| -----------| --------------------------------| -------------------------|
22
+ | ∅ | ∅ | ∅ | <!-- . IS_Y_PARITY --> | Not part of the message |
23
+ | | | | <!-- . IS_R --> | |
24
+ | | | | <!-- . IS_S --> | |
25
+ | -----------| --------| -----------| --------------------------------| -------------------------|
26
+
27
+ The idea is to carry out all steps of the above
28
+ - we do the MANDATORY PRECONDITIONS WCP CHECKS
29
+ - we do the VALIDITY WCP CHECKS
30
+
31
+ we then define
32
+
33
+ valid_chain_id ≡ chain_id_is_0 ∨ chain_id_is_β
34
+ call_ec_recover ≡ valid_chain_id ∧ valid_nonce_bound
35
+ call_keccak_on_rlp ≡ call_ec_recover
36
+
37
+ we impose
38
+
39
+ If call_ec_recover ≡ <false> Then AUTHORITY_RECOVERY_SUCCESS ≡ false
40
+ If call_ec_recover ≡ <true> Then AUTHORITY_RECOVERY_SUCCESS ≡ <prover / gnark defined>
41
+
42
+ - at this point all constraints will be written assuming "If AUTHORITY_RECOVERY_SUCCESS ≡ <true >"
43
+ - also the fields
44
+ ``` go
45
+ macro/AUTHORITY_NONCE
46
+ macro/AUTHORITY_HAS_CODE
47
+ macro/AUTHORITY_IS_DELEGATED
48
+ ```
49
+ must be meaningful. This could be done more directly through a lookup ` RLP_AUTH → HUB.account/ ` .
50
+ We may want to impose a sanity check constraints setting them to 0 otherwise, histoire de fixer les idées.
51
+
52
+ | ---------------------------------------------| -------| ------------------------------------------------------| --------------| -------------------------------------------------------|
53
+ | ` RLP_AUTH ` columns | notes | ` HUB ` columns | notes | |
54
+ | ---------------------------------------------| :-----:| ------------------------------------------------------| :------------:| -------------------------------------------------------|
55
+ | 1 | | hub.DELEGATION | | |
56
+ | rlp_auth.USER_TXN_NUMBER | ✓ | hub.USER_TXN_NUMBER | | |
57
+ | rlp_auth.macro/AUTHORITY_TUPLE_INDEX | ✓ | hub.delegation/AUTHORITY_TUPLE_INDEX | | |
58
+ | rlp_auth.macro/AUTHORITY_RECOVERY_SUCCESS | ✓ | hub.delegation/AUTHORITY_RECOVERY_SUCCESS | | defines whether to load account next or not |
59
+ | ---------------------------------------------| :-----:| ------------------------------------------------------| :------------:| -------------------------------------------------------|
60
+ | rlp_auth.macro/AUTHORITY_HI | ✓ | hub.delegation/AUTHORITY_HI | | |
61
+ | rlp_auth.macro/AUTHORITY_LO | ✓ | hub.delegation/AUTHORITY_LO | | |
62
+ | rlp_auth.macro/ADDRESS_HI | ✓ | hub.delegation/POTENTIALLY_NEW_DELEGATION_ADDRESS_HI | | hub.account/DELEGATION_ADDRESS_HI_NEW will also exist |
63
+ | rlp_auth.macro/ADDRESS_LO | ✓ | hub.delegation/POTENTIALLY_NEW_DELEGATION_ADDRESS_LO | | hub.account/DELEGATION_ADDRESS_LO_NEW |
64
+ | rlp_auth.macro/ADDRESS_IS_ZERO_ADDRESS | ✓ | hub.delegation/POTENTIALLY_RESET_DELEGATION | | |
65
+ | rlp_auth.macro/POTENTIALLY_NEW_CODE_HASH_HI | ✓ | hub.delegation/POTENTIALLY_NEW_CODE_HASH_HI | | new columns: place where to write potential updated |
66
+ | rlp_auth.macro/POTENTIALLY_NEW_CODE_HASH_LO | ✓ | hub.delegation/POTENTIALLY_NEW_CODE_HASH_LO | | code hash |
67
+ | ---------------------------------------------| :-----:| ------------------------------------------------------| --------------| -------------------------------------------------------|
68
+ | rlp_auth.macro/AUTHORITY_NONCE | ⟦ π ⟧ | hub.delegation/AUTHORITY_NONCE | justif. here | read off (potential) upcoming account/ row |
69
+ | rlp_auth.macro/AUTHORITY_HAS_CODE | ⟦ π ⟧ | hub.delegation/AUTHORITY_HAS_CODE | justif. here | |
70
+ | rlp_auth.macro/AUTHORITY_IS_DELEGATED | ⟦ π ⟧ | hub.delegation/AUTHORITY_IS_DELEGATED | justif. here | |
71
+ | ---------------------------------------------| :-----:| ------------------------------------------------------| --------------| -------------------------------------------------------|
72
+ | rlp_auth.macro/PROCEED_WITH_DELEGATION | mixed | hub.delegation/PROCEED_WITH_DELEGATION | | used to decide whether to do something or not |
73
+ | ---------------------------------------------| -------| ------------------------------------------------------| --------------| -------------------------------------------------------|
74
+
75
+ One way to do it in the HUB is as follows:
76
+
77
+ | perspective | AUTHORITY_RECOVERY_SUCCESS | notes |
78
+ | -------------| :--------------------------:| ----------------------------|
79
+ | DELEGATION | <false > | no address, no account row |
80
+ | -------------| ----------------------------| ----------------------------|
81
+ | DELEGATION | <true > | |
82
+ | ACCOUNT | | load account |
83
+ | -------------| ----------------------------| ----------------------------|
84
+ | DELEGATION | <true > | |
85
+ | ACCOUNT | | load account |
86
+ | -------------| ----------------------------| ----------------------------|
87
+ | DELEGATION | <false > | |
88
+ | -------------| ----------------------------| ----------------------------|
89
+ | DELEGATION | <false > | |
90
+ | -------------| ----------------------------| ----------------------------|
91
+ | DELEGATION | <true > | |
92
+ | ACCOUNT | | load account |
93
+ | -------------| ----------------------------| ----------------------------|
94
+
95
+ This way we don't have to create this effective index (AUTHORITY_RECOVERY_SUCCESS_ACCUMULATOR).
96
+
97
+ Now that we have the currently true nonce and other information such as whether the account is delegated or not we proceed:
98
+
99
+ authority_code_is_empty_or_already_delegated ≡ (1 - macro/AUTHORITY_HAS_CODE) ∨ macro/AUTHORITY_IS_DELEGATED
100
+ proceed_with_delegation ≡ authority_code_is_empty_or_already_delegated ∧ nonce_agreement
101
+
102
+ rlp_auth.macro/PROCEED_WITH_DELEGATION ≡ proceed_with_delegation
21
103
22
104
# Lookups
23
105
@@ -36,15 +118,15 @@ We need comparisons (ali ≡ authority list item) to verify MANDATORY PRECONDITI
36
118
| -----------------| --------------| ----------| -----| -----------------------|
37
119
38
120
39
- We also need comparisons that are ALLOWED TO FAIL
121
+ We also need comparisons that are VALIDITY CHECK COMPARISONS (that are ALLOWED TO FAIL)
40
122
41
123
| -----------------| ---------------| ------------------| -------------------------| --------------------------------------------------------------------|
42
124
| WCP instruction | arg1 | arg2 | res | note |
43
125
| -----------------| ---------------| ------------------| -------------------------| --------------------------------------------------------------------|
44
126
| ISZERO | ali.chain_id | | chain_id_is_0 | |
45
127
| EQ | ali.chain_id | β | chain_id_is_β | |
46
128
| LT | ali.nonce | (2 << 64) - 1 | valid_nonce_bound | |
47
- | LT | ali.s | secp256k1 / 2 | valid_s | |
129
+ | LT | ali.s | secp256k1 / 2 | valid_s_bound | |
48
130
| EQ | ali.nonce | hub.acc/NONCE | nonce_agreement | potentially compare ali.nonce with acc/nonce + SENDER_IS_AUTHORITY |
49
131
| EQ | ali.authority | txndata.hub/FROM | sender_is_authority | |
50
132
| ISZERO | ali.address | | address_is_zero_address | |
@@ -55,8 +137,8 @@ We also need comparisons that are ALLOWED TO FAIL
55
137
56
138
We need to RLP-ize the authority list. Recall that these are of the form
57
139
58
- authority_list ≡ [ authority_item, authority_item...]
59
- authority_item ≡ [ chain_id, address, nonce, y_parity, r, s ]
140
+ authority_list ≡ [ authority_item, authority_item...]
141
+ authority_item ≡ [ chain_id, address, nonce, y_parity, r, s ]
60
142
61
143
With
62
144
- chain_id ≡ integer, 32B at most, rlp-ization: 1B to 33B
@@ -68,12 +150,12 @@ With
68
150
69
151
so that
70
152
71
- ζ ≡ RLP( chain_id ) ∙ RLP( address ) ∙ RLP( nonce ) ∙ RLP( y_parity ) ∙ RLP( r ) ∙ RLP( s ) ∈ B_k
153
+ ζ ≡ RLP( chain_id ) ∙ RLP( address ) ∙ RLP( nonce ) ∙ RLP( y_parity ) ∙ RLP( r ) ∙ RLP( s ) ∈ B_k
72
154
73
155
where k ∈ {25, ..., 122}. So that
74
156
75
- RLP( authority_item ) ≡ RLP( ζ )
76
- ≡ <rlp_prefix> ∙ ζ
157
+ RLP( authority_item ) ≡ RLP( ζ )
158
+ ≡ <rlp_prefix> ∙ ζ
77
159
78
160
and so we must call ` RLP_UTILS ` for
79
161
@@ -91,7 +173,7 @@ and so we must call `RLP_UTILS` for
91
173
92
174
and for the whole list
93
175
94
- RLP( authority_list ) ≡ <rlp_prefix> ∙ RLP( item_1 ) ∙ RLP( item_2 ) ∙ ⋯ ∙ RLP( item_n )
176
+ RLP( authority_list ) ≡ <rlp_prefix> ∙ RLP( item_1 ) ∙ RLP( item_2 ) ∙ ⋯ ∙ RLP( item_n )
95
177
96
178
## Lookup to BLOCK_DATA
97
179
@@ -157,7 +239,7 @@ This lookup provides the `RLP_AUTH` with its instructions.
157
239
| rlp_txn.auth/SIGNATURE_S_HI | rlp_auth.macro/SIGNATURE_S_HI | |
158
240
| rlp_txn.auth/SIGNATURE_S_LO | rlp_auth.macro/SIGNATURE_S_LO | |
159
241
| -------------------------------------------| ---------------------------------------------| ------------------------------|
160
- | rlp_txn.auth/IS_VALID_TUPLE | rlp_auth.macro/IS_VALID_TUPLE | |
242
+ | rlp_txn.auth/PROCEED_WITH_DELEGATION | rlp_auth.macro/PROCEED_WITH_DELEGATION | |
161
243
| -------------------------------------------| ---------------------------------------------| ------------------------------|
162
244
| rlp_txn.auth/AUTHORITY_RECOVERY_SUCCESS | rlp_auth.macro/AUTHORITY_RECOVERY_SUCCESS | |
163
245
| rlp_txn.auth/AUTHORITY_HI | rlp_auth.macro/AUTHORITY_HI | |
@@ -174,7 +256,7 @@ This lookup provides the `RLP_AUTH` with its instructions.
174
256
| rlp_txn.auth/POTENTIALLY_NEW_CODE_HASH_LO | rlp_auth.macro/POTENTIALLY_NEW_CODE_HASH_LO | or KEC( ef0100 ∙ <address > ) |
175
257
| -------------------------------------------| ---------------------------------------------| ------------------------------|
176
258
177
- ## Lookup RLP_TXN -> HUB
259
+ ## Lookup RLP_AUTH -> HUB
178
260
179
261
To transmit to transmit the access list tuple to the HUB. It also
180
262
The ` HUB ` should operate under the same order as the transaction has its stuff RLP-ized:
@@ -184,23 +266,23 @@ The `HUB` should operate under the same order as the transaction has its stuff R
184
266
- selector: ` sel ≡ rlp_txn.AUTH ∙ rlp_txn.auth/AUTHORITY_RECOVERY_SUCCESS `
185
267
- correspondence:
186
268
187
- | -------------------------------------------| ------------------------------------------------| -------------------------------------------------------|
188
- | RLP_TXN columns | HUB columns | notes |
189
- | -------------------------------------------| ------------------------------------------------| -------------------------------------------------------|
190
- | 1 | hub.auth | |
191
- | rlp_txn .USER_TXN_NUMBER | hub.USER_TXN_NUMBER | |
192
- | rlp_txn.auth /AUTHORITY_TUPLE_INDEX | hub.auth /AUTHORITY_TUPLE_INDEX | |
193
- | rlp_txn.auth/IS_VALID_TUPLE | hub.auth/IS_VALID_TUPLE | used to decide whether to do something or not |
194
- | rlp_txn.auth /ADDRESS_HI | hub.auth /POTENTIALLY_NEW_DELEGATION_ADDRESS_HI | hub.account/DELEGATION_ADDRESS_HI_NEW will also exist |
195
- | rlp_txn.auth /ADDRESS_LO | hub.auth /POTENTIALLY_NEW_DELEGATION_ADDRESS_LO | hub.account/DELEGATION_ADDRESS_LO_NEW |
196
- | rlp_txn.auth /ADDRESS_IS_ZERO_ADDRESS | hub.auth /POTENTIALLY_RESET_DELEGATION | |
197
- | rlp_txn.auth /POTENTIALLY_NEW_CODE_HASH_HI | hub.auth /POTENTIALLY_NEW_CODE_HASH_HI | new columns: place where to write potential updated |
198
- | rlp_txn.auth /POTENTIALLY_NEW_CODE_HASH_LO | hub.auth /POTENTIALLY_NEW_CODE_HASH_LO | code hash |
199
- | -------------------------------------------| ------------------------------------------------| -------------------------------------------------------|
200
- | rlp_txn.auth /AUTHORITY_HI | hub.account /ADDRESS_HI | |
201
- | rlp_txn.auth /AUTHORITY_LO | hub.account /ADDRESS_LO | |
202
- | rlp_txn.auth /AUTHORITY_NONCE | hub.account /NONCE | |
203
- | rlp_txn.auth /AUTHORITY_HAS_CODE | hub.account /HAS_CODE | |
204
- | rlp_txn.auth /AUTHORITY_IS_DELEGATED | hub.account /IS_DELEGATED | hub.account/IS_DELEGATED_NEW will also exist |
205
- | -------------------------------------------| ------------------------------------------------| -------------------------------------------------------|
269
+ | --------------------------------------------- | ------ ------------------------------------------------| -------------------------------------------------------|
270
+ | RLP_AUTH columns | HUB columns | notes |
271
+ | --------------------------------------------- | ------ ------------------------------------------------| -------------------------------------------------------|
272
+ | 1 | hub.auth | |
273
+ | rlp_auth .USER_TXN_NUMBER | hub.USER_TXN_NUMBER | |
274
+ | rlp_auth.macro /AUTHORITY_TUPLE_INDEX | hub.delegation /AUTHORITY_TUPLE_INDEX | |
275
+ | rlp_auth.macro/PROCEED_WITH_DELEGATION | hub.delegation/PROCEED_WITH_DELEGATION | used to decide whether to do something or not |
276
+ | rlp_auth.macro /ADDRESS_HI | hub.delegation /POTENTIALLY_NEW_DELEGATION_ADDRESS_HI | hub.account/DELEGATION_ADDRESS_HI_NEW will also exist |
277
+ | rlp_auth.macro /ADDRESS_LO | hub.delegation /POTENTIALLY_NEW_DELEGATION_ADDRESS_LO | hub.account/DELEGATION_ADDRESS_LO_NEW |
278
+ | rlp_auth.macro /ADDRESS_IS_ZERO_ADDRESS | hub.delegation /POTENTIALLY_RESET_DELEGATION | |
279
+ | rlp_auth.macro /POTENTIALLY_NEW_CODE_HASH_HI | hub.delegation /POTENTIALLY_NEW_CODE_HASH_HI | new columns: place where to write potential updated |
280
+ | rlp_auth.macro /POTENTIALLY_NEW_CODE_HASH_LO | hub.delegation /POTENTIALLY_NEW_CODE_HASH_LO | code hash |
281
+ | --------------------------------------------- | ------ ------------------------------------------------| -------------------------------------------------------|
282
+ | rlp_auth.macro /AUTHORITY_HI | hub.delegation /ADDRESS_HI | |
283
+ | rlp_auth.macro /AUTHORITY_LO | hub.delegation /ADDRESS_LO | |
284
+ | rlp_auth.macro /AUTHORITY_NONCE | hub.delegation /NONCE | |
285
+ | rlp_auth.macro /AUTHORITY_HAS_CODE | hub.delegation /HAS_CODE | |
286
+ | rlp_auth.macro /AUTHORITY_IS_DELEGATED | hub.delegation /IS_DELEGATED | hub.account/IS_DELEGATED_NEW will also exist |
287
+ | --------------------------------------------- | ------ ------------------------------------------------| -------------------------------------------------------|
206
288
0 commit comments