zkevm-circuits
zkevm-circuits copied to clipboard
EVM circuit word type for address values in ConstraintBuilder methods
Currently in the word-lo-hi
the ConstraintBuilder
methods that receive address arguments use the Word<Expression<F>>
type. Then calls look like this (where 2nd arg is the address):
cb.account_access_list_write_word(
tx_id.expr(),
address.to_word(),
Word::from_lo_unchecked(1.expr()),
Word::from_lo_unchecked(is_warm.expr()),
Some(&mut reversion_info),
);
CC has argued in favor of this API https://github.com/privacy-scaling-explorations/zkevm-circuits/pull/1441#discussion_r1210535805
I would argue in favor of passing an address in the Expression<F>
type because it's the format that is being used in the Table (a single expression holding a 160 bit value, instead of two expression holding lo/hi).
My reason is that we should try to match the best type for the argument, and if necessary do any conversion.
Nevertheless we have cases where we encode addresses as Words, and in such case it may be better to receive a Word because turning an Expression<F>
into Word
requires extra cells. This could be an argument against this proposal because in the best scenario we may have a mix of address
and address_as_word
which could be confusing?
I think there's no urgency to resolve this, and we can discuss this after the word-lo-hi is merged in main.