-
Notifications
You must be signed in to change notification settings - Fork 2
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
CIP-64 / CIP-66 compatible TransactionArgs
#123
Changes from 1 commit
d434cce
577d152
526563d
8e46539
9f238e6
9d0aa80
815cb7c
7a87ae6
3689a77
27a328d
dbb2c57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,14 +154,15 @@ func toWordSize(size uint64) uint64 { | |
// A Message contains the data derived from a single transaction that is relevant to state | ||
// processing. | ||
type Message struct { | ||
To *common.Address | ||
From common.Address | ||
Nonce uint64 | ||
Value *big.Int | ||
GasLimit uint64 | ||
GasPrice *big.Int | ||
GasFeeCap *big.Int | ||
GasTipCap *big.Int | ||
To *common.Address | ||
From common.Address | ||
Nonce uint64 | ||
Value *big.Int | ||
GasLimit uint64 | ||
GasPrice *big.Int | ||
GasFeeCap *big.Int | ||
GasTipCap *big.Int | ||
|
||
Data []byte | ||
AccessList types.AccessList | ||
BlobGasFeeCap *big.Int | ||
|
@@ -182,8 +183,7 @@ type Message struct { | |
// FeeCurrency specifies the currency for gas fees. | ||
// `nil` corresponds to Celo Gold (native currency). | ||
// All other values should correspond to ERC20 contract addresses. | ||
FeeCurrency *common.Address | ||
|
||
FeeCurrency *common.Address | ||
MaxFeeInFeeCurrency *big.Int // MaxFeeInFeeCurrency is the maximum fee that can be charged in the fee currency. | ||
} | ||
|
||
|
@@ -213,7 +213,7 @@ func TransactionToMessage(tx *types.Transaction, s types.Signer, baseFee *big.In | |
} | ||
// If baseFee provided, set gasPrice to effectiveGasPrice. | ||
if baseFee != nil { | ||
if msg.FeeCurrency != nil { | ||
if tx.Type() == types.CeloDynamicFeeTxType { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change safe for the case where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the |
||
var err error | ||
baseFee, err = exchange.ConvertGoldToCurrency(exchangeRates, msg.FeeCurrency, baseFee) | ||
if err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -445,10 +445,11 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, ex | |
gas = globalGasCap | ||
} | ||
var ( | ||
gasPrice *big.Int | ||
gasFeeCap *big.Int | ||
gasTipCap *big.Int | ||
blobFeeCap *big.Int | ||
gasPrice *big.Int | ||
gasFeeCap *big.Int | ||
gasTipCap *big.Int | ||
blobFeeCap *big.Int | ||
maxFeeInFeeCurrency *big.Int | ||
Comment on lines
+441
to
+445
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in dbb2c57 |
||
) | ||
if baseFee == nil { | ||
// If there's no basefee, then it must be a non-1559 execution | ||
|
@@ -501,20 +502,24 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, ex | |
if args.AccessList != nil { | ||
accessList = *args.AccessList | ||
} | ||
if args.MaxFeeInFeeCurrency != nil { | ||
maxFeeInFeeCurrency = args.MaxFeeInFeeCurrency.ToInt() | ||
} | ||
msg := &core.Message{ | ||
From: addr, | ||
To: args.To, | ||
Value: value, | ||
GasLimit: gas, | ||
GasPrice: gasPrice, | ||
GasFeeCap: gasFeeCap, | ||
GasTipCap: gasTipCap, | ||
Data: data, | ||
AccessList: accessList, | ||
BlobGasFeeCap: blobFeeCap, | ||
BlobHashes: args.BlobHashes, | ||
SkipAccountChecks: true, | ||
FeeCurrency: args.FeeCurrency, | ||
From: addr, | ||
To: args.To, | ||
Value: value, | ||
GasLimit: gas, | ||
GasPrice: gasPrice, | ||
GasFeeCap: gasFeeCap, | ||
GasTipCap: gasTipCap, | ||
Data: data, | ||
AccessList: accessList, | ||
BlobGasFeeCap: blobFeeCap, | ||
BlobHashes: args.BlobHashes, | ||
SkipAccountChecks: true, | ||
FeeCurrency: args.FeeCurrency, | ||
MaxFeeInFeeCurrency: maxFeeInFeeCurrency, | ||
} | ||
return msg, nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an unnecessary change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in dbb2c57