mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-05 23:33:07 +00:00
terminology
This commit is contained in:
parent
0ba6078984
commit
d1cb854cf2
@ -1,5 +1,5 @@
|
||||
// Type 0 transactions, aka legacy transaction, have the format
|
||||
// rlp([nonce, gas_price, gas_limit, destination, amount, data, v, r, s])
|
||||
// rlp([nonce, gas_price, gas_limit, to, value, data, v, r, s])
|
||||
//
|
||||
// The field v was originally encoded as
|
||||
// 27 + y_parity
|
||||
@ -7,9 +7,9 @@
|
||||
// 35 + 2 * chain_id + y_parity
|
||||
//
|
||||
// If a chain_id is present in v, the signed data is
|
||||
// keccak256(rlp([nonce, gas_price, gas_limit, destination, amount, data, chain_id, 0, 0]))
|
||||
// keccak256(rlp([nonce, gas_price, gas_limit, to, value, data, chain_id, 0, 0]))
|
||||
// otherwise, it is
|
||||
// keccak256(rlp([nonce, gas_price, gas_limit, destination, amount, data]))
|
||||
// keccak256(rlp([nonce, gas_price, gas_limit, to, value, data]))
|
||||
|
||||
global process_type_0_txn:
|
||||
JUMPDEST
|
||||
@ -58,34 +58,34 @@ store_gas_limit:
|
||||
%mstore_current(@SEGMENT_NORMALIZED_TXN)
|
||||
|
||||
// Peak at the RLP to see if the next byte is zero.
|
||||
// If so, there is no destination field, so skip the store_destination step.
|
||||
// If so, there is no value field, so skip the store_to step.
|
||||
// stack: pos
|
||||
DUP1
|
||||
%mload_current(@SEGMENT_RLP_RAW)
|
||||
ISZERO
|
||||
// stack: destination_empty, pos
|
||||
%jumpi(parse_amount)
|
||||
// stack: to_empty, pos
|
||||
%jumpi(parse_value)
|
||||
|
||||
// If we got here, there is a destination field.
|
||||
PUSH store_destination
|
||||
// If we got here, there is a "to" field.
|
||||
PUSH store_to
|
||||
SWAP1
|
||||
// stack: pos, store_destination
|
||||
// stack: pos, store_to
|
||||
%jump(decode_rlp_scalar)
|
||||
|
||||
store_destination:
|
||||
%stack (pos, destination) -> (@TXN_FIELD_DESTINATION, destination, pos)
|
||||
store_to:
|
||||
%stack (pos, to) -> (@TXN_FIELD_TO, to, pos)
|
||||
%mstore_current(@SEGMENT_NORMALIZED_TXN)
|
||||
// stack: pos
|
||||
|
||||
parse_amount:
|
||||
parse_value:
|
||||
// stack: pos
|
||||
PUSH store_amount
|
||||
PUSH store_value
|
||||
SWAP1
|
||||
// stack: pos, store_amount
|
||||
// stack: pos, store_value
|
||||
%jump(decode_rlp_scalar)
|
||||
|
||||
store_amount:
|
||||
%stack (pos, amount) -> (@TXN_FIELD_AMOUNT, amount, pos)
|
||||
store_value:
|
||||
%stack (pos, value) -> (@TXN_FIELD_VALUE, value, pos)
|
||||
%mstore_current(@SEGMENT_NORMALIZED_TXN)
|
||||
|
||||
// stack: pos
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
// Type 2 transactions, introduced by EIP 1559, have the format
|
||||
// 0x02 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas,
|
||||
// gas_limit, destination, amount, data, access_list, y_parity,
|
||||
// r, s])
|
||||
// gas_limit, to, value, data, access_list, y_parity, r, s])
|
||||
//
|
||||
// The signed data is
|
||||
// keccak256(0x02 || rlp([chain_id, nonce, max_priority_fee_per_gas,
|
||||
// max_fee_per_gas, gas_limit, destination, amount,
|
||||
// data, access_list]))
|
||||
// max_fee_per_gas, gas_limit, to, value, data,
|
||||
// access_list]))
|
||||
|
||||
global process_type_2_txn:
|
||||
JUMPDEST
|
||||
|
||||
@ -10,8 +10,8 @@ pub(crate) enum NormalizedTxnField {
|
||||
MaxPriorityFeePerGas = 3,
|
||||
MaxFeePerGas = 4,
|
||||
GasLimit = 5,
|
||||
Destination = 6,
|
||||
Amount = 7,
|
||||
To = 6,
|
||||
Value = 7,
|
||||
/// The length of the data field. The data itself is stored in another segment.
|
||||
DataLen = 8,
|
||||
YParity = 9,
|
||||
@ -30,8 +30,8 @@ impl NormalizedTxnField {
|
||||
Self::MaxPriorityFeePerGas,
|
||||
Self::MaxFeePerGas,
|
||||
Self::GasLimit,
|
||||
Self::Destination,
|
||||
Self::Amount,
|
||||
Self::To,
|
||||
Self::Value,
|
||||
Self::DataLen,
|
||||
Self::YParity,
|
||||
Self::R,
|
||||
@ -48,8 +48,8 @@ impl NormalizedTxnField {
|
||||
NormalizedTxnField::MaxPriorityFeePerGas => "TXN_FIELD_MAX_PRIORITY_FEE_PER_GAS",
|
||||
NormalizedTxnField::MaxFeePerGas => "TXN_FIELD_MAX_FEE_PER_GAS",
|
||||
NormalizedTxnField::GasLimit => "TXN_FIELD_GAS_LIMIT",
|
||||
NormalizedTxnField::Destination => "TXN_FIELD_DESTINATION",
|
||||
NormalizedTxnField::Amount => "TXN_FIELD_AMOUNT",
|
||||
NormalizedTxnField::To => "TXN_FIELD_TO",
|
||||
NormalizedTxnField::Value => "TXN_FIELD_VALUE",
|
||||
NormalizedTxnField::DataLen => "TXN_FIELD_DATA_LEN",
|
||||
NormalizedTxnField::YParity => "TXN_FIELD_Y_PARITY",
|
||||
NormalizedTxnField::R => "TXN_FIELD_R",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user