Grapchast message takes optional radio payload because of prost::Message implication to take an Optional field; this doesn't make sense since the point of Graphcast message is to send radio payload message. Investigate ways to provide payload without making it optional
Graphcast agent wallet signs over radio payload field inside Graphcast message. Security can be improved by signing over Graphcast message fields such as block hash, block number, nonce, identifier, graph_account, etc.
Expectation proposal
Require payload in GraphcastMessage
Update GraphcastMessage structure and signed data types
Current Graphcast Message is structured as below such that only payload:T is signed by the signature
pub struct GraphcastMessage<T>
where
T: Message
+ ethers::types::transaction::eip712::Eip712
+ Default
+ Clone
+ 'static
+ async_graphql::OutputType,
{
pub identifier: String, // not necessary as included in payload: T
pub payload: T, // EIP712 signed
pub nonce: i64, // not EIP712 signed, secure Graphcast level
pub network: String, // not EIP712 signed, optional for radios
pub block_number: u64, // not EIP712 signed, secure Graphcast level, may not be available for message sender
pub block_hash: String, // not EIP712 signed, secure Graphcast level, may not be available for message sender
pub graph_account: String, // not EIP712 signed, secure Graphcast level
pub signature: String, // Signature field after signing over payload: T
}
Two options for Message layered structure
1.
Thinking about other message types such as "upgrade_version_message" from subgraph developer, fields such as "block_number", "block_hash" shouldn't be needed in the message. These two fields only make sense in context for senders and receivers with valid block provider
The check "valid_block_hash" might be on a message type specific level to poi-radio
Move appropriate fields to Radio Payload message that're already of Eip712 types
Propose to move nonce, network, graph_account so that the fields can be securely signed .
Propose to move block_number, block_hash so that general operators of a radio operator might not need access from a block provider.
GraphcastMessage has identifier, payload, signature left
2.
Enforce Eip712 message typing on Graphcast message,
block_number, block_hash becomes optional,
use graph_account or some constant as a placeholder on signature when building GraphcastMessage, sign over message and then replace the signature field
require extra handling at decryption as well, it must read the message fields and replace graph_account before recovering sender address from the signature
Love it. Also think the first approach is better, it's cleaner in the sense that it doesn't leave the Optional fields in the top-level message and enables more freedom when defining the Radio-specific message types.
Problem statement
prost::Message
implication to take an Optional field; this doesn't make sense since the point of Graphcast message is to send radio payload message. Investigate ways to provide payload without making it optionalExpectation proposal
Current Graphcast Message is structured as below such that only payload:T is signed by the signature
Two options for Message layered structure 1.
nonce, network, graph_account
so that the fields can be securely signed .block_number, block_hash
so that general operators of a radio operator might not need access from a block provider.block_number, block_hash
becomes optional,graph_account
or some constant as a placeholder onsignature
when buildingGraphcastMessage
, sign over message and then replace the signature fieldAlternative consideration