Skip to content

Commit b0867c6

Browse files
authored
Return packed availability claim payloads (#407)
* Return packed availability claim payloads * chore: inc ver
1 parent 79187d6 commit b0867c6

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

extensions/business/oracle_management/oracle_api.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,12 @@ def __eth_to_internal(self, eth_node_address):
182182

183183
def __get_signed_data(self, node_addr : str, epochs : list, epochs_vals : list, sign=True, node_addr_eth=None):
184184
"""
185-
Sign the given data using the blockchain engine.
186-
Returns the signature.
187-
Use the data param as it will be modified in place.
185+
Sign the requested node availability range using the blockchain engine.
186+
187+
The EVM signature covers the compact claim payload:
188+
``node_eth_address, from_epoch, to_epoch, packed_availabilities``. The
189+
response also keeps the expanded ``epochs`` and ``epochs_vals`` lists so
190+
API consumers can inspect the oracle data that was packed.
188191
189192
Parameters
190193
----------
@@ -209,9 +212,15 @@ def __get_signed_data(self, node_addr : str, epochs : list, epochs_vals : list,
209212
)
210213
eth_signature = res["signature"]
211214
inputs = res["eth_signed_data"]
215+
from_epoch = res["from_epoch"]
216+
to_epoch = res["to_epoch"]
217+
packed_availabilities = res["packed_availabilities"]
212218
else:
213219
eth_signature = []
214220
inputs = []
221+
from_epoch = epochs[0] if len(epochs) > 0 else None
222+
to_epoch = epochs[-1] if len(epochs) > 0 else None
223+
packed_availabilities = "0x"
215224

216225
eth_signatures = [eth_signature]
217226
eth_addresses = [self.bc.eth_address]
@@ -226,6 +235,9 @@ def __get_signed_data(self, node_addr : str, epochs : list, epochs_vals : list,
226235
'node_alias': node_alias,
227236
'epochs': epochs,
228237
'epochs_vals': epochs_vals,
238+
'from_epoch': from_epoch,
239+
'to_epoch': to_epoch,
240+
'packed_availabilities': packed_availabilities,
229241

230242
'eth_signed_data' : {
231243
"input" : inputs,

0 commit comments

Comments
 (0)