-
Notifications
You must be signed in to change notification settings - Fork 274
Extend Address class to handle BN #276
Comments
Thanks for opening an issue to discuss :) Yeah I still don't understand why the address would be stored as a BN as opposed to buffer. Would it be trivial to update the vm to handle it as a buffer? The If we did want to introduce instantiating from a |
Not sure but would guess that BN was chosen as a default stack format because quantities are common and many opcodes perform arithmetic operations. By contrast there are 7 places in
I think it would be simpler to keep a single stack data format. Otherwise wherever BN is assumed on
Good question - fooled around with this a bit and couldn't see any difference between masked and unmasked conversions. Unfortunately I can't find anything in the repo history about the original intent behind this either. So idk...is maybe a case of Chesterton's fence? What is your view?
Ok yes, that's smart. |
Maybe the best thing to do is just extend the |
Small note here: the |
@jochem-brouwer Ah thanks!! That's great. |
Some reference: the stack item Regarding Since these things are so tiny (no one will likely open a PR just for this): would it make sense to have some ongoing static tracking issue with a TODO list where everyone can put such things with a short reference and everyone who feels like it takes these things up on a sideline along the dedicated main PR, just adds theses things and removes from the TODO list? 🤔 |
ethereumjs-vm 919 resolves this, closing. |
(This topic came up in discussions last week...opening to get feedback on what the best approach might be.)
Background
Details
new BN(addressBuffer)
.Question
Should the Address class be extended here to handle this case? Or should that logic stay in the VM (because it's an atypical usage).
Pro: cleaner to write
new Address(addressBN).toString()
than what is currently necessary at the VMCon: a little weird? would also require updating this dependency in the monorepo
The text was updated successfully, but these errors were encountered: