Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction constructor fails to initialize falsy values #1189

Closed
alcuadrado opened this issue Apr 7, 2021 · 2 comments · Fixed by #1190
Closed

Transaction constructor fails to initialize falsy values #1189

alcuadrado opened this issue Apr 7, 2021 · 2 comments · Fixed by #1190

Comments

@alcuadrado
Copy link
Member

alcuadrado commented Apr 7, 2021

This is pattern that is probably present in other libs, at least block. The constructor uses non-boolean values as conditions to decide wether to initialize a field or no, so it's impossible to initialize them to falsy values.

Here's a way to reproduce it

const Common = require("@ethereumjs/common").default;
const { AccessListEIP2930Transaction } = require("@ethereumjs/tx");

const tx = new AccessListEIP2930Transaction(
  { v: 0 }, // 0 is a valid v value in eip 2930
  { common: new Common({ chain: "mainnet", hardfork: "berlin" }) }
);

console.log(tx.v) // this is undefined, but should be BN(0)
@holgerd77
Copy link
Member

Ok, this is really bad, since this renders the whole AccessListEIP2930Transaction functionality unusable.

Not sure if I will make it to still submit a bugfix PR today, but we should generally release ASAP and likely - even if this doesn't look so good to admit - deprecate v3.1.1 and v3.1.2 on npm.

@holgerd77
Copy link
Member

This is actually only happening in some certain constructor combination (so on fromTxData() respectively when using the main constructor directly), we have the general problem that we have the default value setting clustered which can get inconsistent. I will address this along on some PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants