Skip to content

Commit 4a7a547

Browse files
holgerd77jochem-brouwer
authored andcommitted
tx -> EIP-2930: set default HF from common to berlin, small fixes
1 parent 3539369 commit 4a7a547

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

packages/tx/src/baseTransaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ export abstract class BaseTransaction<TransactionObject> {
3636
value: this.value,
3737
}
3838

39-
this.validateExcdeedsMaxInteger(validateCannotExceedMaxInteger)
39+
this.validateExceedsMaxInteger(validateCannotExceedMaxInteger)
4040

4141
this.common =
4242
(txOptions.common &&
4343
Object.assign(Object.create(Object.getPrototypeOf(txOptions.common)), txOptions.common)) ??
4444
DEFAULT_COMMON
4545
}
4646

47-
protected validateExcdeedsMaxInteger(validateCannotExceedMaxInteger: { [key: string]: BN }) {
47+
protected validateExceedsMaxInteger(validateCannotExceedMaxInteger: { [key: string]: BN }) {
4848
for (const [key, value] of Object.entries(validateCannotExceedMaxInteger)) {
4949
if (value && value.gt(MAX_INTEGER)) {
5050
throw new Error(`${key} cannot exceed MAX_INTEGER, given ${value}`)

packages/tx/src/legacyTransaction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default class LegacyTransaction extends BaseTransaction<LegacyTransaction
101101
s: this.s ?? new BN(0),
102102
}
103103

104-
this.validateExcdeedsMaxInteger(validateCannotExceedMaxInteger)
104+
this.validateExceedsMaxInteger(validateCannotExceedMaxInteger)
105105

106106
if (this.v) {
107107
this._validateTxV(this.v)

packages/tx/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,4 @@ export interface JsonTx {
183183
type?: string
184184
}
185185

186-
export const DEFAULT_COMMON = new Common({ chain: 'mainnet' })
186+
export const DEFAULT_COMMON = new Common({ chain: 'mainnet', hardfork: 'berlin' })

packages/tx/test/api.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tape('[Transaction]: Basic functions', function (t) {
2121

2222
t.test('should initialize correctly', function (st) {
2323
let tx = LegacyTransaction.fromTxData({})
24-
st.equal(tx.common.hardfork(), 'istanbul', 'should initialize with correct default HF')
24+
st.equal(tx.common.hardfork(), 'berlin', 'should initialize with correct default HF')
2525
st.ok(Object.isFrozen(tx), 'tx should be frozen by default')
2626

2727
const common = new Common({ chain: 'mainnet', hardfork: 'spuriousDragon' })

0 commit comments

Comments
 (0)