mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-21 22:08:08 +00:00
38fa9197ca
Initial EIP1559 implementation Fix a few small issues Progress on Python lib implementation and firmware Fix RLP length Start fixing tests Fix legacy transactions Simplify API and logic Add EIP1559 tests Fix access list formatting Fix UI visiblity issue Fix commented out code fix: correct linting issues Fix access_list protobuf formatting Remove unneeded code Remove dead code Check tx_type bounds for EIP 2718 Reduce code duplication Prefer eip2718_type over re-using tx_type Add more tests Simplify format_access_list Simplify sign_tx slightly Change Access List format and add logic to encode it Fix a bunch of small PR comments Fix a linting issue Move tests out of class and regenerate Remove copy-pasted comments Add access list to CLI Simplify _parse_access_list_item Fix small mistakes following rebase Fix linting Refactor to use a separate message for EIP 1559 tx Simplify changed legacy code Fix a few small PR comments Fix linting fix(legacy): recognize SignTxEIP1559 on legacy build Fix PR comments
151 lines
5.5 KiB
Protocol Buffer
151 lines
5.5 KiB
Protocol Buffer
syntax = "proto2";
|
|
package hw.trezor.messages.ethereum;
|
|
|
|
// Sugar for easier handling in Java
|
|
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
|
option java_outer_classname = "TrezorMessageEthereum";
|
|
|
|
import "messages-common.proto";
|
|
|
|
|
|
/**
|
|
* Request: Ask device for public key corresponding to address_n path
|
|
* @start
|
|
* @next EthereumPublicKey
|
|
* @next Failure
|
|
*/
|
|
message EthereumGetPublicKey {
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
optional bool show_display = 2; // optionally show on display before sending the result
|
|
}
|
|
|
|
/**
|
|
* Response: Contains public key derived from device private seed
|
|
* @end
|
|
*/
|
|
message EthereumPublicKey {
|
|
required hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node
|
|
required string xpub = 2; // serialized form of public node
|
|
}
|
|
|
|
/**
|
|
* Request: Ask device for Ethereum address corresponding to address_n path
|
|
* @start
|
|
* @next EthereumAddress
|
|
* @next Failure
|
|
*/
|
|
message EthereumGetAddress {
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
optional bool show_display = 2; // optionally show on display before sending the result
|
|
}
|
|
|
|
/**
|
|
* Response: Contains an Ethereum address derived from device private seed
|
|
* @end
|
|
*/
|
|
message EthereumAddress {
|
|
optional bytes _old_address = 1 [deprecated=true]; // trezor <1.8.0, <2.1.0 - raw bytes of Ethereum address
|
|
optional string address = 2; // Ethereum address as hex-encoded string
|
|
}
|
|
|
|
/**
|
|
* Request: Ask device to sign transaction
|
|
* All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
|
|
* Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
|
|
* @start
|
|
* @next EthereumTxRequest
|
|
* @next Failure
|
|
*/
|
|
message EthereumSignTx {
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
optional bytes nonce = 2; // <=256 bit unsigned big endian
|
|
optional bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
|
|
optional bytes gas_limit = 4; // <=256 bit unsigned big endian
|
|
optional string to = 11; // recipient address
|
|
optional bytes value = 6; // <=256 bit unsigned big endian (in wei)
|
|
optional bytes data_initial_chunk = 7; // The initial data chunk (<= 1024 bytes)
|
|
optional uint32 data_length = 8; // Length of transaction payload
|
|
optional uint32 chain_id = 9; // Chain Id for EIP 155
|
|
optional uint32 tx_type = 10; // Used for Wanchain
|
|
}
|
|
|
|
/**
|
|
* Request: Ask device to sign EIP1559 transaction
|
|
* Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
|
|
* @start
|
|
* @next EthereumTxRequest
|
|
* @next Failure
|
|
*/
|
|
message EthereumSignTxEIP1559 {
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
required bytes nonce = 2; // <=256 bit unsigned big endian
|
|
required bytes max_gas_fee = 3; // <=256 bit unsigned big endian (in wei)
|
|
required bytes max_priority_fee = 4; // <=256 bit unsigned big endian (in wei)
|
|
required bytes gas_limit = 5; // <=256 bit unsigned big endian
|
|
optional string to = 6 [default='']; // recipient address
|
|
required bytes value = 7; // <=256 bit unsigned big endian (in wei)
|
|
optional bytes data_initial_chunk = 8 [default='']; // The initial data chunk (<= 1024 bytes)
|
|
required uint32 data_length = 9; // Length of transaction payload
|
|
required uint32 chain_id = 10; // Chain Id for EIP 155
|
|
repeated EthereumAccessList access_list = 11; // Access List
|
|
|
|
message EthereumAccessList {
|
|
required string address = 1;
|
|
repeated bytes storage_keys = 2;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Response: Device asks for more data from transaction payload, or returns the signature.
|
|
* If data_length is set, device awaits that many more bytes of payload.
|
|
* Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
|
|
* @end
|
|
* @next EthereumTxAck
|
|
*/
|
|
message EthereumTxRequest {
|
|
optional uint32 data_length = 1; // Number of bytes being requested (<= 1024)
|
|
optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28)
|
|
optional bytes signature_r = 3; // Computed signature R component (256 bit)
|
|
optional bytes signature_s = 4; // Computed signature S component (256 bit)
|
|
}
|
|
|
|
/**
|
|
* Request: Transaction payload data.
|
|
* @next EthereumTxRequest
|
|
*/
|
|
message EthereumTxAck {
|
|
optional bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes)
|
|
}
|
|
|
|
/**
|
|
* Request: Ask device to sign message
|
|
* @start
|
|
* @next EthereumMessageSignature
|
|
* @next Failure
|
|
*/
|
|
message EthereumSignMessage {
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
optional bytes message = 2; // message to be signed
|
|
}
|
|
|
|
/**
|
|
* Response: Signed message
|
|
* @end
|
|
*/
|
|
message EthereumMessageSignature {
|
|
required bytes signature = 2; // signature of the message
|
|
required string address = 3; // address used to sign the message
|
|
}
|
|
|
|
/**
|
|
* Request: Ask device to verify message
|
|
* @start
|
|
* @next Success
|
|
* @next Failure
|
|
*/
|
|
message EthereumVerifyMessage {
|
|
optional bytes signature = 2; // signature to verify
|
|
optional bytes message = 3; // message to verify
|
|
optional string address = 4; // address to verify
|
|
}
|